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 events (\n `Date received` date, -- example: ['2014-07-03', '2012-04-12']\n `Sub-product` text, -- example: ['Checking account', 'Savings account']\n `Sub-issue` text,\n Tags text, -- example: ['Older American', 'Older American, Servicemember']\n `Consumer consent provided?` text, -- Tags Consumer consent provided?, example: ['N/A', 'Consent not provided']\n `Company response to consumer` text, -- example: ['Closed with explanation', 'Closed', 'Untimely response', 'Closed with relief']\n `Timely response?` text, -- example: ['Yes', 'No']\n `Consumer disputed?` text, -- example: ['Yes', 'No']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n Client_ID text, -- example: ['C00003714', 'C00001366']\n PRIMARY KEY (`Complaint ID`, Client_ID),\n CONSTRAINT fk_events_complaint_id FOREIGN KEY (`Complaint ID`) REFERENCES callcenterlogs (`Complaint ID`),\n CONSTRAINT fk_events_client_id FOREIGN KEY (Client_ID) REFERENCES client (client_id)\n);\n\nCREATE TABLE district (\n district_id integer, -- example: [1, 2]\n city text, -- example: ['New York City', 'Jacksonville']\n state_abbrev text, -- example: ['NY', 'FL']\n division text, -- example: ['Middle Atlantic', 'South Atlantic']\n PRIMARY KEY (district_id),\n CONSTRAINT fk_district_state_abbrev FOREIGN KEY (state_abbrev) REFERENCES state (StateCode)\n);\n\nCREATE TABLE callcenterlogs (\n `Date received` date, -- example: ['2017-03-27', '2017-03-23']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n `rand client` text, -- example: ['C00004587', 'C00003328']\n phonefinal text, -- example: ['977-806-9726', '322-598-7152']\n `vru+line` text, -- voice response unit line, example: ['AA0103', 'AA0205']\n call_id integer, -- example: [34536, 34537]\n priority integer, -- example: [0, 2]\n type text, -- example: ['NW', 'PS']\n outcome text, -- example: ['AGENT', 'HANG']\n server text, -- example: ['MICHAL', 'TOVA']\n ser_exit text, -- server exit, example: ['13:40:23', '11:16:10']\n PRIMARY KEY (`Complaint ID`),\n CONSTRAINT fk_callcenterlogs_rand_client FOREIGN KEY (`rand client`) REFERENCES client (client_id)\n);\n\nCREATE TABLE reviews (\n `Date` date, -- example: ['2013-02-04', '2013-02-06']\n Product text, -- example: ['Eagle National Mortgage', 'Eagle National Bank']\n district_id integer, -- example: [65, 66]\n PRIMARY KEY (`Date`),\n CONSTRAINT fk_reviews_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE state (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE client (\n client_id text, -- example: ['C00000001', 'C00000002']\n sex text, -- example: ['Female', 'Male']\n `day` integer, -- example: [13, 4]\n `month` integer, -- example: [12, 2]\n `year` integer, -- example: [1990, 1965]\n social text, -- example: ['926-93-2157', '806-94-5725']\n first text, -- example: ['Emma', 'Noah']\n middle text, -- example: ['Avaya', 'Everest']\n last text, -- example: ['Smith', 'Thompson']\n phone text, -- example: ['367-171-6840', '212-423-7734']\n email text, -- example: ['emma.smith@gmail.com', 'noah.thompson@gmail.com']\n address_2 text, -- example: ['Unit 1', 'Unit 6']\n city text, -- example: ['Albuquerque', 'New York City']\n state text, -- example: ['NM', 'NY']\n district_id integer, -- example: [18, 1]\n PRIMARY KEY (client_id),\n CONSTRAINT fk_client_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin year 2015 refers to Date received LIKE '2015%'; timely response refers to Timely response?\" = 'Yes'; closed with an explanation refers to Company response to consumer = 'Closed with explanation'\nAmong the complaints received in year 2015, what is total number of complaints timely response and closed with an explanation?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE strftime('%Y', T1.`Date received`) = '2015' AND T2.`Timely response?` = 'Yes' AND T2.`Company response to consumer` = 'Closed with explanation'",
"style": "rule"
} | {
"db_id": "retail_complains.sqlite",
"gt_sql": "SELECT COUNT(T1.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE strftime('%Y', T1.`Date received`) = '2015' AND T2.`Timely response?` = 'Yes' AND T2.`Company response to consumer` = 'Closed with explanation'",
"index": 200,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE events (\n `Date received` date, -- example: ['2014-07-03', '2012-04-12']\n `Sub-product` text, -- example: ['Checking account', 'Savings account']\n `Sub-issue` text,\n Tags text, -- example: ['Older American', 'Older American, Servicemember']\n `Consumer consent provided?` text, -- Tags Consumer consent provided?, example: ['N/A', 'Consent not provided']\n `Company response to consumer` text, -- example: ['Closed with explanation', 'Closed', 'Untimely response', 'Closed with relief']\n `Timely response?` text, -- example: ['Yes', 'No']\n `Consumer disputed?` text, -- example: ['Yes', 'No']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n Client_ID text, -- example: ['C00003714', 'C00001366']\n PRIMARY KEY (`Complaint ID`, Client_ID),\n CONSTRAINT fk_events_complaint_id FOREIGN KEY (`Complaint ID`) REFERENCES callcenterlogs (`Complaint ID`),\n CONSTRAINT fk_events_client_id FOREIGN KEY (Client_ID) REFERENCES client (client_id)\n);\n\nCREATE TABLE district (\n district_id integer, -- example: [1, 2]\n city text, -- example: ['New York City', 'Jacksonville']\n state_abbrev text, -- example: ['NY', 'FL']\n division text, -- example: ['Middle Atlantic', 'South Atlantic']\n PRIMARY KEY (district_id),\n CONSTRAINT fk_district_state_abbrev FOREIGN KEY (state_abbrev) REFERENCES state (StateCode)\n);\n\nCREATE TABLE callcenterlogs (\n `Date received` date, -- example: ['2017-03-27', '2017-03-23']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n `rand client` text, -- example: ['C00004587', 'C00003328']\n phonefinal text, -- example: ['977-806-9726', '322-598-7152']\n `vru+line` text, -- voice response unit line, example: ['AA0103', 'AA0205']\n call_id integer, -- example: [34536, 34537]\n priority integer, -- example: [0, 2]\n type text, -- example: ['NW', 'PS']\n outcome text, -- example: ['AGENT', 'HANG']\n server text, -- example: ['MICHAL', 'TOVA']\n ser_exit text, -- server exit, example: ['13:40:23', '11:16:10']\n PRIMARY KEY (`Complaint ID`),\n CONSTRAINT fk_callcenterlogs_rand_client FOREIGN KEY (`rand client`) REFERENCES client (client_id)\n);\n\nCREATE TABLE reviews (\n `Date` date, -- example: ['2013-02-04', '2013-02-06']\n Product text, -- example: ['Eagle National Mortgage', 'Eagle National Bank']\n district_id integer, -- example: [65, 66]\n PRIMARY KEY (`Date`),\n CONSTRAINT fk_reviews_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE state (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE client (\n client_id text, -- example: ['C00000001', 'C00000002']\n sex text, -- example: ['Female', 'Male']\n `day` integer, -- example: [13, 4]\n `month` integer, -- example: [12, 2]\n `year` integer, -- example: [1990, 1965]\n social text, -- example: ['926-93-2157', '806-94-5725']\n first text, -- example: ['Emma', 'Noah']\n middle text, -- example: ['Avaya', 'Everest']\n last text, -- example: ['Smith', 'Thompson']\n phone text, -- example: ['367-171-6840', '212-423-7734']\n email text, -- example: ['emma.smith@gmail.com', 'noah.thompson@gmail.com']\n address_2 text, -- example: ['Unit 1', 'Unit 6']\n city text, -- example: ['Albuquerque', 'New York City']\n state text, -- example: ['NM', 'NY']\n district_id integer, -- example: [18, 1]\n PRIMARY KEY (client_id),\n CONSTRAINT fk_client_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin year 2015 refers to Date received LIKE '2015%'; timely response refers to Timely response?\" = 'Yes'; closed with an explanation refers to Company response to consumer = 'Closed with explanation'\nAmong the complaints received in year 2015, what is total number of complaints timely response and closed with an explanation?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n StateCode text, -- example: ['MA', 'AL', 'AR']\n State text, -- example: ['Massachusetts', 'Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE client (\n client_id text, -- example: ['C00000001', 'C00000002']\n sex text, -- example: ['Female', 'Male']\n `day` integer, -- example: [13, 4]\n `month` integer, -- example: [12, 2]\n `year` integer, -- example: [1990, 1965]\n age integer, -- example: [29, 54]\n social text, -- example: ['926-93-2157', '806-94-5725']\n first text, -- example: ['Emma', 'Noah']\n middle text, -- example: ['Star', 'Avaya', 'Everest']\n last text, -- example: ['Newton', 'Ma', 'Smith', 'Thompson']\n phone text, -- example: ['367-171-6840', '212-423-7734']\n email text, -- example: ['emma.smith@gmail.com', 'noah.thompson@gmail.com']\n address_1 text, -- example: ['387 Wellington Ave.', '75 W. Berkshire St.']\n city text, -- example: ['Newton', 'Albuquerque', 'New York City']\n state text, -- example: ['MA', 'NM', 'NY']\n zipcode integer, -- example: [47246, 10040]\n district_id integer, -- example: [18, 1]\n PRIMARY KEY (client_id),\n CONSTRAINT fk_client_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE reviews (\n `Date` date, -- example: ['2016-03-14', '2013-02-04', '2013-02-06']\n Stars integer, -- example: [5, 1]\n Reviews text, -- example: ['Great job, Eagle National! Each person w', 'Matthew Richardson is professional and h']\n Product text, -- example: ['Eagle National Mortgage', 'Eagle National Bank']\n district_id integer, -- example: [65, 66]\n PRIMARY KEY (`Date`),\n CONSTRAINT fk_reviews_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE callcenterlogs (\n `Date received` date, -- example: ['2016-03-14', '2016-03-12', '2017-03-27', '2017-03-23']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n `rand client` text, -- example: ['C00004587', 'C00003328']\n phonefinal text, -- example: ['977-806-9726', '322-598-7152']\n `vru+line` text, -- voice response unit line, example: ['AA0103', 'AA0205']\n call_id integer, -- example: [34536, 34537]\n priority integer, -- example: [0, 2]\n type text, -- example: ['NW', 'PS']\n ser_start text, -- server start, example: ['13:34:11', '10:58:22']\n ser_exit text, -- server exit, example: ['13:40:23', '11:16:10']\n ser_time text, -- server time, example: ['00:06:12', '00:17:48']\n PRIMARY KEY (`Complaint ID`),\n CONSTRAINT fk_callcenterlogs_rand_client FOREIGN KEY (`rand client`) REFERENCES client (client_id)\n);\n\nCREATE TABLE district (\n district_id integer, -- example: [1, 2]\n city text, -- example: ['Newton', 'New York City', 'Jacksonville']\n state_abbrev text, -- example: ['MA', 'NY', 'FL']\n division text, -- example: ['Middle Atlantic', 'South Atlantic']\n PRIMARY KEY (district_id),\n CONSTRAINT fk_district_state_abbrev FOREIGN KEY (state_abbrev) REFERENCES state (StateCode)\n);\n\nCREATE TABLE events (\n `Date received` date, -- example: ['2016-03-14', '2014-07-03', '2012-04-12']\n Product text, -- example: ['Bank account or service', 'Credit card']\n `Sub-product` text, -- example: ['Checking account', 'Savings account']\n Issue text, -- example: ['Deposits and withdrawals', 'Account opening, closing, or management']\n `Consumer complaint narrative` text, -- example: ['Deposited a XXXX check into my account, ', \"I called Eagle National Bank 's customer\"]\n Tags text, -- example: ['Older American', 'Older American, Servicemember']\n `Consumer consent provided?` text, -- Tags Consumer consent provided?, example: ['N/A', 'Consent not provided']\n `Submitted via` text, -- example: ['Email', 'Fax']\n `Date sent to company` text, -- example: ['2016-03-14', '2014-07-09', '2012-04-13']\n `Company response to consumer` text, -- example: ['Closed with explanation', 'Closed with relief']\n `Timely response?` text, -- example: ['Yes', 'No']\n `Consumer disputed?` text, -- example: ['No', 'Yes']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n Client_ID text, -- example: ['C00003714', 'C00001366']\n PRIMARY KEY (`Complaint ID`, Client_ID),\n CONSTRAINT fk_events_complaint_id FOREIGN KEY (`Complaint ID`) REFERENCES callcenterlogs (`Complaint ID`),\n CONSTRAINT fk_events_client_id FOREIGN KEY (Client_ID) REFERENCES client (client_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1 star refers to Stars = 1; on March 14, 2016 refers to Date = '2016-03-14'; Newton refers to city = 'Newton'; Massachusetts refers to state_abbrev = 'MA'\nList the product reviewed with 1 star on March 14, 2016 from Newton, Massachusetts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Product FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T1.city = 'Newton' AND T1.state_abbrev = 'MA' AND T2.Date = '2016-03-14' AND T2.Stars = 1",
"style": "rule"
} | {
"db_id": "retail_complains.sqlite",
"gt_sql": "SELECT T2.Product FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T1.city = 'Newton' AND T1.state_abbrev = 'MA' AND T2.Date = '2016-03-14' AND T2.Stars = 1",
"index": 201,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE state (\n StateCode text, -- example: ['MA', 'AL', 'AR']\n State text, -- example: ['Massachusetts', 'Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE client (\n client_id text, -- example: ['C00000001', 'C00000002']\n sex text, -- example: ['Female', 'Male']\n `day` integer, -- example: [13, 4]\n `month` integer, -- example: [12, 2]\n `year` integer, -- example: [1990, 1965]\n age integer, -- example: [29, 54]\n social text, -- example: ['926-93-2157', '806-94-5725']\n first text, -- example: ['Emma', 'Noah']\n middle text, -- example: ['Star', 'Avaya', 'Everest']\n last text, -- example: ['Newton', 'Ma', 'Smith', 'Thompson']\n phone text, -- example: ['367-171-6840', '212-423-7734']\n email text, -- example: ['emma.smith@gmail.com', 'noah.thompson@gmail.com']\n address_1 text, -- example: ['387 Wellington Ave.', '75 W. Berkshire St.']\n city text, -- example: ['Newton', 'Albuquerque', 'New York City']\n state text, -- example: ['MA', 'NM', 'NY']\n zipcode integer, -- example: [47246, 10040]\n district_id integer, -- example: [18, 1]\n PRIMARY KEY (client_id),\n CONSTRAINT fk_client_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE reviews (\n `Date` date, -- example: ['2016-03-14', '2013-02-04', '2013-02-06']\n Stars integer, -- example: [5, 1]\n Reviews text, -- example: ['Great job, Eagle National! Each person w', 'Matthew Richardson is professional and h']\n Product text, -- example: ['Eagle National Mortgage', 'Eagle National Bank']\n district_id integer, -- example: [65, 66]\n PRIMARY KEY (`Date`),\n CONSTRAINT fk_reviews_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE callcenterlogs (\n `Date received` date, -- example: ['2016-03-14', '2016-03-12', '2017-03-27', '2017-03-23']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n `rand client` text, -- example: ['C00004587', 'C00003328']\n phonefinal text, -- example: ['977-806-9726', '322-598-7152']\n `vru+line` text, -- voice response unit line, example: ['AA0103', 'AA0205']\n call_id integer, -- example: [34536, 34537]\n priority integer, -- example: [0, 2]\n type text, -- example: ['NW', 'PS']\n ser_start text, -- server start, example: ['13:34:11', '10:58:22']\n ser_exit text, -- server exit, example: ['13:40:23', '11:16:10']\n ser_time text, -- server time, example: ['00:06:12', '00:17:48']\n PRIMARY KEY (`Complaint ID`),\n CONSTRAINT fk_callcenterlogs_rand_client FOREIGN KEY (`rand client`) REFERENCES client (client_id)\n);\n\nCREATE TABLE district (\n district_id integer, -- example: [1, 2]\n city text, -- example: ['Newton', 'New York City', 'Jacksonville']\n state_abbrev text, -- example: ['MA', 'NY', 'FL']\n division text, -- example: ['Middle Atlantic', 'South Atlantic']\n PRIMARY KEY (district_id),\n CONSTRAINT fk_district_state_abbrev FOREIGN KEY (state_abbrev) REFERENCES state (StateCode)\n);\n\nCREATE TABLE events (\n `Date received` date, -- example: ['2016-03-14', '2014-07-03', '2012-04-12']\n Product text, -- example: ['Bank account or service', 'Credit card']\n `Sub-product` text, -- example: ['Checking account', 'Savings account']\n Issue text, -- example: ['Deposits and withdrawals', 'Account opening, closing, or management']\n `Consumer complaint narrative` text, -- example: ['Deposited a XXXX check into my account, ', \"I called Eagle National Bank 's customer\"]\n Tags text, -- example: ['Older American', 'Older American, Servicemember']\n `Consumer consent provided?` text, -- Tags Consumer consent provided?, example: ['N/A', 'Consent not provided']\n `Submitted via` text, -- example: ['Email', 'Fax']\n `Date sent to company` text, -- example: ['2016-03-14', '2014-07-09', '2012-04-13']\n `Company response to consumer` text, -- example: ['Closed with explanation', 'Closed with relief']\n `Timely response?` text, -- example: ['Yes', 'No']\n `Consumer disputed?` text, -- example: ['No', 'Yes']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n Client_ID text, -- example: ['C00003714', 'C00001366']\n PRIMARY KEY (`Complaint ID`, Client_ID),\n CONSTRAINT fk_events_complaint_id FOREIGN KEY (`Complaint ID`) REFERENCES callcenterlogs (`Complaint ID`),\n CONSTRAINT fk_events_client_id FOREIGN KEY (Client_ID) REFERENCES client (client_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1 star refers to Stars = 1; on March 14, 2016 refers to Date = '2016-03-14'; Newton refers to city = 'Newton'; Massachusetts refers to state_abbrev = 'MA'\nList the product reviewed with 1 star on March 14, 2016 from Newton, Massachusetts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE callcenterlogs (\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n `rand client` text, -- example: ['C00004587', 'C00003328']\n phonefinal text, -- example: ['977-806-9726', '322-598-7152']\n type text, -- example: ['NW', 'PS']\n ser_time text, -- server time, example: ['00:06:12', '00:17:48']\n PRIMARY KEY (`Complaint ID`),\n CONSTRAINT fk_callcenterlogs_rand_client FOREIGN KEY (`rand client`) REFERENCES client (client_id)\n);\n\nCREATE TABLE reviews (\n `Date` date, -- example: ['2013-02-04', '2013-02-06']\n Stars integer, -- example: [5, 1]\n Reviews text, -- example: ['Great job, Eagle National! Each person w', 'Matthew Richardson is professional and h']\n Product text, -- example: ['Eagle National Bank', 'Eagle National Mortgage']\n district_id integer, -- example: [65, 66]\n PRIMARY KEY (`Date`),\n CONSTRAINT fk_reviews_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE district (\n district_id integer, -- example: [1, 2]\n city text, -- example: ['Nashville', 'New York City', 'Jacksonville']\n state_abbrev text, -- example: ['TN', 'NY', 'FL']\n PRIMARY KEY (district_id),\n CONSTRAINT fk_district_state_abbrev FOREIGN KEY (state_abbrev) REFERENCES state (StateCode)\n);\n\nCREATE TABLE state (\n StateCode text, -- example: ['TN', 'AL', 'AR']\n State text, -- example: ['Tennessee', 'Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE client (\n client_id text, -- example: ['C00000001', 'C00000002']\n `day` integer, -- example: [13, 4]\n social text, -- example: ['926-93-2157', '806-94-5725']\n first text, -- example: ['Emma', 'Noah']\n city text, -- example: ['Nashville', 'Albuquerque', 'New York City']\n state text, -- example: ['TN', 'NM', 'NY']\n zipcode integer, -- example: [47246, 10040]\n district_id integer, -- example: [18, 1]\n PRIMARY KEY (client_id),\n CONSTRAINT fk_client_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE events (\n Product text, -- example: ['Bank account or service', 'Credit card']\n `Consumer complaint narrative` text, -- example: ['Deposited a XXXX check into my account, ', \"I called Eagle National Bank 's customer\"]\n Tags text, -- example: ['Older American', 'Older American, Servicemember']\n `Consumer disputed?` text, -- example: ['No', 'Yes']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n Client_ID text, -- example: ['C00003714', 'C00001366']\n PRIMARY KEY (`Complaint ID`, Client_ID),\n CONSTRAINT fk_events_complaint_id FOREIGN KEY (`Complaint ID`) REFERENCES callcenterlogs (`Complaint ID`),\n CONSTRAINT fk_events_client_id FOREIGN KEY (Client_ID) REFERENCES client (client_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n5 star refers to Stars = 5; Nashville refers to city = 'Nashville'; Tennessee refers to state_abbrev = 'TN'\nIn reviews for the Eagle National Bank product, how many of the 5 star reviews where from Nashville, Tennessee?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Stars) FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T1.city = 'Nashville' AND T1.state_abbrev = 'TN' AND T2.Product = 'Eagle National Mortgage' AND T2.Stars = 5",
"style": "rule"
} | {
"db_id": "retail_complains.sqlite",
"gt_sql": "SELECT COUNT(T2.Stars) FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T1.city = 'Nashville' AND T1.state_abbrev = 'TN' AND T2.Product = 'Eagle National Mortgage' AND T2.Stars = 5",
"index": 202,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE callcenterlogs (\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n `rand client` text, -- example: ['C00004587', 'C00003328']\n phonefinal text, -- example: ['977-806-9726', '322-598-7152']\n type text, -- example: ['NW', 'PS']\n ser_time text, -- server time, example: ['00:06:12', '00:17:48']\n PRIMARY KEY (`Complaint ID`),\n CONSTRAINT fk_callcenterlogs_rand_client FOREIGN KEY (`rand client`) REFERENCES client (client_id)\n);\n\nCREATE TABLE reviews (\n `Date` date, -- example: ['2013-02-04', '2013-02-06']\n Stars integer, -- example: [5, 1]\n Reviews text, -- example: ['Great job, Eagle National! Each person w', 'Matthew Richardson is professional and h']\n Product text, -- example: ['Eagle National Bank', 'Eagle National Mortgage']\n district_id integer, -- example: [65, 66]\n PRIMARY KEY (`Date`),\n CONSTRAINT fk_reviews_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE district (\n district_id integer, -- example: [1, 2]\n city text, -- example: ['Nashville', 'New York City', 'Jacksonville']\n state_abbrev text, -- example: ['TN', 'NY', 'FL']\n PRIMARY KEY (district_id),\n CONSTRAINT fk_district_state_abbrev FOREIGN KEY (state_abbrev) REFERENCES state (StateCode)\n);\n\nCREATE TABLE state (\n StateCode text, -- example: ['TN', 'AL', 'AR']\n State text, -- example: ['Tennessee', 'Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE client (\n client_id text, -- example: ['C00000001', 'C00000002']\n `day` integer, -- example: [13, 4]\n social text, -- example: ['926-93-2157', '806-94-5725']\n first text, -- example: ['Emma', 'Noah']\n city text, -- example: ['Nashville', 'Albuquerque', 'New York City']\n state text, -- example: ['TN', 'NM', 'NY']\n zipcode integer, -- example: [47246, 10040]\n district_id integer, -- example: [18, 1]\n PRIMARY KEY (client_id),\n CONSTRAINT fk_client_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE events (\n Product text, -- example: ['Bank account or service', 'Credit card']\n `Consumer complaint narrative` text, -- example: ['Deposited a XXXX check into my account, ', \"I called Eagle National Bank 's customer\"]\n Tags text, -- example: ['Older American', 'Older American, Servicemember']\n `Consumer disputed?` text, -- example: ['No', 'Yes']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n Client_ID text, -- example: ['C00003714', 'C00001366']\n PRIMARY KEY (`Complaint ID`, Client_ID),\n CONSTRAINT fk_events_complaint_id FOREIGN KEY (`Complaint ID`) REFERENCES callcenterlogs (`Complaint ID`),\n CONSTRAINT fk_events_client_id FOREIGN KEY (Client_ID) REFERENCES client (client_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n5 star refers to Stars = 5; Nashville refers to city = 'Nashville'; Tennessee refers to state_abbrev = 'TN'\nIn reviews for the Eagle National Bank product, how many of the 5 star reviews where from Nashville, Tennessee?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE callcenterlogs (\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n `rand client` text, -- example: ['C00004587', 'C00003328']\n phonefinal text, -- example: ['977-806-9726', '322-598-7152']\n `vru+line` text, -- voice response unit line, example: ['AA0103', 'AA0205']\n type text, -- example: ['NW', 'PS']\n ser_start text, -- server start, example: ['13:34:11', '10:58:22']\n ser_exit text, -- server exit, example: ['13:40:23', '11:16:10']\n PRIMARY KEY (`Complaint ID`),\n CONSTRAINT fk_callcenterlogs_rand_client FOREIGN KEY (`rand client`) REFERENCES client (client_id)\n);\n\nCREATE TABLE client (\n client_id text, -- example: ['C00000001', 'C00000002']\n sex text, -- example: ['Female', 'Male']\n `day` integer, -- example: [13, 4]\n `month` integer, -- example: [12, 2]\n age integer, -- example: [29, 54]\n first text, -- example: ['Emma', 'Noah']\n middle text, -- example: ['Star', 'Avaya', 'Everest']\n phone text, -- example: ['367-171-6840', '212-423-7734']\n email text, -- example: ['emma.smith@gmail.com', 'noah.thompson@gmail.com']\n address_1 text, -- example: ['387 Wellington Ave.', '75 W. Berkshire St.']\n state text, -- example: ['NM', 'NY']\n district_id integer, -- example: [18, 1]\n PRIMARY KEY (client_id),\n CONSTRAINT fk_client_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE events (\n `Date received` date, -- example: ['2014-07-03', '2012-04-12']\n Product text, -- example: ['Bank account or service', 'Credit card']\n `Sub-product` text, -- example: ['Checking account', 'Savings account']\n Issue text, -- example: ['Deposits and withdrawals', 'Account opening, closing, or management']\n `Sub-issue` text,\n `Consumer complaint narrative` text, -- example: ['Deposited a XXXX check into my account, ', \"I called Eagle National Bank 's customer\"]\n `Company response to consumer` text, -- example: ['Closed with explanation', 'Closed with relief']\n `Timely response?` text, -- example: ['Yes', 'No']\n `Consumer disputed?` text, -- example: ['No', 'Yes']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n Client_ID text, -- example: ['C00003714', 'C00001366']\n PRIMARY KEY (`Complaint ID`, Client_ID),\n CONSTRAINT fk_events_complaint_id FOREIGN KEY (`Complaint ID`) REFERENCES callcenterlogs (`Complaint ID`),\n CONSTRAINT fk_events_client_id FOREIGN KEY (Client_ID) REFERENCES client (client_id)\n);\n\nCREATE TABLE state (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['Midwest', 'South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE reviews (\n `Date` date, -- example: ['2013-02-04', '2013-02-06']\n Stars integer, -- example: [5, 1]\n Reviews text, -- example: ['Great job, Eagle National! Each person w', 'Matthew Richardson is professional and h']\n Product text, -- example: ['Eagle National Mortgage', 'Eagle National Bank']\n district_id integer, -- example: [65, 66]\n PRIMARY KEY (`Date`),\n CONSTRAINT fk_reviews_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE district (\n district_id integer, -- example: [1, 2]\n city text, -- example: ['New York City', 'Jacksonville']\n state_abbrev text, -- example: ['NY', 'FL']\n division text, -- example: ['Middle Atlantic', 'South Atlantic']\n PRIMARY KEY (district_id),\n CONSTRAINT fk_district_state_abbrev FOREIGN KEY (state_abbrev) REFERENCES state (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1 star refers to Stars = 1\nAmong the reviews from midwest region, what are the products that received 1 star?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.Product FROM state AS T1 INNER JOIN district AS T2 ON T1.StateCode = T2.state_abbrev INNER JOIN reviews AS T3 ON T2.district_id = T3.district_id WHERE T1.Region = 'Midwest' AND T3.Stars = 1",
"style": "rule"
} | {
"db_id": "retail_complains.sqlite",
"gt_sql": "SELECT DISTINCT T3.Product FROM state AS T1 INNER JOIN district AS T2 ON T1.StateCode = T2.state_abbrev INNER JOIN reviews AS T3 ON T2.district_id = T3.district_id WHERE T1.Region = 'Midwest' AND T3.Stars = 1",
"index": 203,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE callcenterlogs (\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n `rand client` text, -- example: ['C00004587', 'C00003328']\n phonefinal text, -- example: ['977-806-9726', '322-598-7152']\n `vru+line` text, -- voice response unit line, example: ['AA0103', 'AA0205']\n type text, -- example: ['NW', 'PS']\n ser_start text, -- server start, example: ['13:34:11', '10:58:22']\n ser_exit text, -- server exit, example: ['13:40:23', '11:16:10']\n PRIMARY KEY (`Complaint ID`),\n CONSTRAINT fk_callcenterlogs_rand_client FOREIGN KEY (`rand client`) REFERENCES client (client_id)\n);\n\nCREATE TABLE client (\n client_id text, -- example: ['C00000001', 'C00000002']\n sex text, -- example: ['Female', 'Male']\n `day` integer, -- example: [13, 4]\n `month` integer, -- example: [12, 2]\n age integer, -- example: [29, 54]\n first text, -- example: ['Emma', 'Noah']\n middle text, -- example: ['Star', 'Avaya', 'Everest']\n phone text, -- example: ['367-171-6840', '212-423-7734']\n email text, -- example: ['emma.smith@gmail.com', 'noah.thompson@gmail.com']\n address_1 text, -- example: ['387 Wellington Ave.', '75 W. Berkshire St.']\n state text, -- example: ['NM', 'NY']\n district_id integer, -- example: [18, 1]\n PRIMARY KEY (client_id),\n CONSTRAINT fk_client_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE events (\n `Date received` date, -- example: ['2014-07-03', '2012-04-12']\n Product text, -- example: ['Bank account or service', 'Credit card']\n `Sub-product` text, -- example: ['Checking account', 'Savings account']\n Issue text, -- example: ['Deposits and withdrawals', 'Account opening, closing, or management']\n `Sub-issue` text,\n `Consumer complaint narrative` text, -- example: ['Deposited a XXXX check into my account, ', \"I called Eagle National Bank 's customer\"]\n `Company response to consumer` text, -- example: ['Closed with explanation', 'Closed with relief']\n `Timely response?` text, -- example: ['Yes', 'No']\n `Consumer disputed?` text, -- example: ['No', 'Yes']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n Client_ID text, -- example: ['C00003714', 'C00001366']\n PRIMARY KEY (`Complaint ID`, Client_ID),\n CONSTRAINT fk_events_complaint_id FOREIGN KEY (`Complaint ID`) REFERENCES callcenterlogs (`Complaint ID`),\n CONSTRAINT fk_events_client_id FOREIGN KEY (Client_ID) REFERENCES client (client_id)\n);\n\nCREATE TABLE state (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['Midwest', 'South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE reviews (\n `Date` date, -- example: ['2013-02-04', '2013-02-06']\n Stars integer, -- example: [5, 1]\n Reviews text, -- example: ['Great job, Eagle National! Each person w', 'Matthew Richardson is professional and h']\n Product text, -- example: ['Eagle National Mortgage', 'Eagle National Bank']\n district_id integer, -- example: [65, 66]\n PRIMARY KEY (`Date`),\n CONSTRAINT fk_reviews_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE district (\n district_id integer, -- example: [1, 2]\n city text, -- example: ['New York City', 'Jacksonville']\n state_abbrev text, -- example: ['NY', 'FL']\n division text, -- example: ['Middle Atlantic', 'South Atlantic']\n PRIMARY KEY (district_id),\n CONSTRAINT fk_district_state_abbrev FOREIGN KEY (state_abbrev) REFERENCES state (StateCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1 star refers to Stars = 1\nAmong the reviews from midwest region, what are the products that received 1 star?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE reviews (\n `Date` date, -- example: ['2013-02-04', '2013-02-06']\n Stars integer, -- example: [5, 1]\n Reviews text, -- example: ['Great job, Eagle National! Each person w', 'Matthew Richardson is professional and h']\n Product text, -- example: ['Eagle National Mortgage', 'Eagle National Bank']\n district_id integer, -- example: [65, 66]\n PRIMARY KEY (`Date`),\n CONSTRAINT fk_reviews_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE state (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE callcenterlogs (\n `Date received` date, -- example: ['2017-03-27', '2017-03-23']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n `rand client` text, -- example: ['C00004587', 'C00003328']\n phonefinal text, -- example: ['977-806-9726', '322-598-7152']\n `vru+line` text, -- voice response unit line, example: ['AA0103', 'AA0205']\n outcome text, -- example: ['AGENT', 'HANG']\n server text, -- example: ['MICHAL', 'TOVA']\n ser_start text, -- server start, example: ['13:34:11', '10:58:22']\n ser_exit text, -- server exit, example: ['13:40:23', '11:16:10']\n ser_time text, -- server time, example: ['00:06:12', '00:17:48']\n PRIMARY KEY (`Complaint ID`),\n CONSTRAINT fk_callcenterlogs_rand_client FOREIGN KEY (`rand client`) REFERENCES client (client_id)\n);\n\nCREATE TABLE events (\n `Date received` date, -- example: ['2014-07-03', '2012-04-12']\n Product text, -- example: ['Bank account or service', 'Credit card']\n `Sub-product` text, -- example: ['Checking account', 'Savings account']\n `Sub-issue` text,\n `Consumer complaint narrative` text, -- example: ['Deposited a XXXX check into my account, ', \"I called Eagle National Bank 's customer\"]\n Tags text, -- example: ['Older American', 'Older American, Servicemember']\n `Submitted via` text, -- example: ['Phone', 'Email', 'Fax']\n `Date sent to company` text, -- example: ['2014-07-09', '2012-04-13']\n `Company response to consumer` text, -- example: ['Closed with explanation', 'Closed with relief']\n `Timely response?` text, -- example: ['Yes', 'No']\n `Consumer disputed?` text, -- example: ['No', 'Yes']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n Client_ID text, -- example: ['C00003714', 'C00001366']\n PRIMARY KEY (`Complaint ID`, Client_ID),\n CONSTRAINT fk_events_complaint_id FOREIGN KEY (`Complaint ID`) REFERENCES callcenterlogs (`Complaint ID`),\n CONSTRAINT fk_events_client_id FOREIGN KEY (Client_ID) REFERENCES client (client_id)\n);\n\nCREATE TABLE district (\n district_id integer, -- example: [1, 2]\n city text, -- example: ['New York City', 'Jacksonville']\n state_abbrev text, -- example: ['NY', 'FL']\n division text, -- example: ['Middle Atlantic', 'South Atlantic']\n PRIMARY KEY (district_id),\n CONSTRAINT fk_district_state_abbrev FOREIGN KEY (state_abbrev) REFERENCES state (StateCode)\n);\n\nCREATE TABLE client (\n client_id text, -- example: ['C00000001', 'C00000002']\n sex text, -- example: ['Female', 'Male']\n `day` integer, -- example: [13, 4]\n `month` integer, -- example: [12, 2]\n `year` integer, -- example: [1990, 1965]\n age integer, -- example: [29, 54]\n social text, -- example: ['926-93-2157', '806-94-5725']\n last text, -- example: ['Smith', 'Thompson']\n phone text, -- example: ['367-171-6840', '212-423-7734']\n address_1 text, -- example: ['387 Wellington Ave.', '75 W. Berkshire St.']\n address_2 text, -- example: ['Unit 1', 'Unit 6']\n city text, -- example: ['Albuquerque', 'New York City']\n state text, -- example: ['NM', 'NY']\n district_id integer, -- example: [18, 1]\n PRIMARY KEY (client_id),\n CONSTRAINT fk_client_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2014 refers to Date received LIKE '2014%'; submitted via call refers to Submitted via = 'Phone'\nIn complaints received in 2014, how many of them were submitted via call?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.`Submitted via` = 'Phone' AND strftime('%Y', T1.`Date received`) = '2014'",
"style": "rule"
} | {
"db_id": "retail_complains.sqlite",
"gt_sql": "SELECT COUNT(T2.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.`Submitted via` = 'Phone' AND strftime('%Y', T1.`Date received`) = '2014'",
"index": 204,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE reviews (\n `Date` date, -- example: ['2013-02-04', '2013-02-06']\n Stars integer, -- example: [5, 1]\n Reviews text, -- example: ['Great job, Eagle National! Each person w', 'Matthew Richardson is professional and h']\n Product text, -- example: ['Eagle National Mortgage', 'Eagle National Bank']\n district_id integer, -- example: [65, 66]\n PRIMARY KEY (`Date`),\n CONSTRAINT fk_reviews_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\n\nCREATE TABLE state (\n StateCode text, -- example: ['AL', 'AR']\n State text, -- example: ['Alabama', 'Arkansas']\n Region text, -- example: ['South', 'West']\n PRIMARY KEY (StateCode)\n);\n\nCREATE TABLE callcenterlogs (\n `Date received` date, -- example: ['2017-03-27', '2017-03-23']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n `rand client` text, -- example: ['C00004587', 'C00003328']\n phonefinal text, -- example: ['977-806-9726', '322-598-7152']\n `vru+line` text, -- voice response unit line, example: ['AA0103', 'AA0205']\n outcome text, -- example: ['AGENT', 'HANG']\n server text, -- example: ['MICHAL', 'TOVA']\n ser_start text, -- server start, example: ['13:34:11', '10:58:22']\n ser_exit text, -- server exit, example: ['13:40:23', '11:16:10']\n ser_time text, -- server time, example: ['00:06:12', '00:17:48']\n PRIMARY KEY (`Complaint ID`),\n CONSTRAINT fk_callcenterlogs_rand_client FOREIGN KEY (`rand client`) REFERENCES client (client_id)\n);\n\nCREATE TABLE events (\n `Date received` date, -- example: ['2014-07-03', '2012-04-12']\n Product text, -- example: ['Bank account or service', 'Credit card']\n `Sub-product` text, -- example: ['Checking account', 'Savings account']\n `Sub-issue` text,\n `Consumer complaint narrative` text, -- example: ['Deposited a XXXX check into my account, ', \"I called Eagle National Bank 's customer\"]\n Tags text, -- example: ['Older American', 'Older American, Servicemember']\n `Submitted via` text, -- example: ['Phone', 'Email', 'Fax']\n `Date sent to company` text, -- example: ['2014-07-09', '2012-04-13']\n `Company response to consumer` text, -- example: ['Closed with explanation', 'Closed with relief']\n `Timely response?` text, -- example: ['Yes', 'No']\n `Consumer disputed?` text, -- example: ['No', 'Yes']\n `Complaint ID` text, -- example: ['CR0000072', 'CR0000084']\n Client_ID text, -- example: ['C00003714', 'C00001366']\n PRIMARY KEY (`Complaint ID`, Client_ID),\n CONSTRAINT fk_events_complaint_id FOREIGN KEY (`Complaint ID`) REFERENCES callcenterlogs (`Complaint ID`),\n CONSTRAINT fk_events_client_id FOREIGN KEY (Client_ID) REFERENCES client (client_id)\n);\n\nCREATE TABLE district (\n district_id integer, -- example: [1, 2]\n city text, -- example: ['New York City', 'Jacksonville']\n state_abbrev text, -- example: ['NY', 'FL']\n division text, -- example: ['Middle Atlantic', 'South Atlantic']\n PRIMARY KEY (district_id),\n CONSTRAINT fk_district_state_abbrev FOREIGN KEY (state_abbrev) REFERENCES state (StateCode)\n);\n\nCREATE TABLE client (\n client_id text, -- example: ['C00000001', 'C00000002']\n sex text, -- example: ['Female', 'Male']\n `day` integer, -- example: [13, 4]\n `month` integer, -- example: [12, 2]\n `year` integer, -- example: [1990, 1965]\n age integer, -- example: [29, 54]\n social text, -- example: ['926-93-2157', '806-94-5725']\n last text, -- example: ['Smith', 'Thompson']\n phone text, -- example: ['367-171-6840', '212-423-7734']\n address_1 text, -- example: ['387 Wellington Ave.', '75 W. Berkshire St.']\n address_2 text, -- example: ['Unit 1', 'Unit 6']\n city text, -- example: ['Albuquerque', 'New York City']\n state text, -- example: ['NM', 'NY']\n district_id integer, -- example: [18, 1]\n PRIMARY KEY (client_id),\n CONSTRAINT fk_client_district_id FOREIGN KEY (district_id) REFERENCES district (district_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2014 refers to Date received LIKE '2014%'; submitted via call refers to Submitted via = 'Phone'\nIn complaints received in 2014, how many of them were submitted via call?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['The Production Company', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Room', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\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 production company refers to movie_company; movie \"Four Rooms\" refers to title = 'Four Rooms'\nPlease list the names of the production company of the movie \"Four Rooms\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Four Rooms'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Four Rooms'",
"index": 205,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['The Production Company', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Room', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\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 production company refers to movie_company; movie \"Four Rooms\" refers to title = 'Four Rooms'\nPlease list the names of the production company of the movie \"Four Rooms\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['company', 'list', 'producer', 'universe', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Universal Pictures', 'Universal', 'The Production Company', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n runtime integer, -- example: [98, 121]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Producer', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Universal Pictures\" refers to company_name = 'Universal Pictures'\nPlease list the titles of all the movie produced by production company \"Universal Pictures\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Universal Pictures'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Universal Pictures'",
"index": 206,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['company', 'list', 'producer', 'universe', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Universal Pictures', 'Universal', 'The Production Company', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n runtime integer, -- example: [98, 121]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Producer', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Universal Pictures\" refers to company_name = 'Universal Pictures'\nPlease list the titles of all the movie produced by production company \"Universal Pictures\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: [\"Pirates of the Caribbean: At World's End\", 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['caribbean', 'producer', 'pirate', 'world', 'crew', 'work']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Producer', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Crew Member', 'Producer', 'Pirate', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Crew', 'Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nworked as producer refers to job = 'Producer'; \"Pirates of the Caribbean: At World's End\" refers to title = 'Pirates of the Caribbean: At World''s End'\nHow many crew members worked as producer in the movie \"Pirates of the Caribbean: At World's End\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Producer'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(T3.person_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Producer'",
"index": 207,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: [\"Pirates of the Caribbean: At World's End\", 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['caribbean', 'producer', 'pirate', 'world', 'crew', 'work']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Producer', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Crew Member', 'Producer', 'Pirate', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Crew', 'Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nworked as producer refers to job = 'Producer'; \"Pirates of the Caribbean: At World's End\" refers to title = 'Pirates of the Caribbean: At World''s End'\nHow many crew members worked as producer in the movie \"Pirates of the Caribbean: At World's End\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Producer', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: [\"Pirates of the Caribbean: At World's End\", 'The Producers', 'Four Rooms', 'Star Wars']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_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 refers to person_name; producers refers to job = 'Producer'; \"Pirates of the Caribbean: At World's End\" refers to title = 'Pirates of the Caribbean: At World''s End'\nPlease list the names of all the producers in the movie \"Pirates of the Caribbean: At World's End\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Producer'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Producer'",
"index": 208,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Producer', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: [\"Pirates of the Caribbean: At World's End\", 'The Producers', 'Four Rooms', 'Star Wars']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_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 refers to person_name; producers refers to job = 'Producer'; \"Pirates of the Caribbean: At World's End\" refers to title = 'Pirates of the Caribbean: At World''s End'\nPlease list the names of all the producers in the movie \"Pirates of the Caribbean: At World's End\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['The One', 'Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['photography', 'director', 'work', 'vote', 'job', 'what if']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Dariusz Wolski', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirector of photography refers to job = 'Director of Photography'; highest average vote refers to max(vote_average)\nAmong the movie in which Dariusz Wolski works as the director of photography, what is the title of the one with the highest average vote?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography' ORDER BY T1.vote_average DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography' ORDER BY T1.vote_average DESC LIMIT 1",
"index": 209,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['The One', 'Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['photography', 'director', 'work', 'vote', 'job', 'what if']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Dariusz Wolski', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirector of photography refers to job = 'Director of Photography'; highest average vote refers to max(vote_average)\nAmong the movie in which Dariusz Wolski works as the director of photography, what is the title of the one with the highest average vote?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['The Director', 'Director', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['photography', 'director', 'count', 'work', 'job', 'b movie']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Dariusz Wolski', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirector of photography refers to job = 'Director of Photography'; average revenue = divide(sum(revenue), count(movie_id))\nWhat is the average revenue of the movie in which Dariusz Wolski works as the director of photography?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T1.revenue) AS REAL) / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT CAST(SUM(T1.revenue) AS REAL) / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography'",
"index": 210,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['The Director', 'Director', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['photography', 'director', 'count', 'work', 'job', 'b movie']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Dariusz Wolski', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirector of photography refers to job = 'Director of Photography'; average revenue = divide(sum(revenue), count(movie_id))\nWhat is the average revenue of the movie in which Dariusz Wolski works as the director of photography?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_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 the movie refers to title; revenue of 559852396 refers to revenue = '559852396'\nGive the name of the movie with a revenue of 559852396.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM movie WHERE revenue = 559852396",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT title FROM movie WHERE revenue = 559852396",
"index": 211,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_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 the movie refers to title; revenue of 559852396 refers to revenue = '559852396'\nGive the name of the movie with a revenue of 559852396.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['I Hope They Serve Beer in Hell', 'Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"I Hope They Serve Beer in Hell\" refers to title = 'I Hope They Serve Beer in Hell';\nShow the total number of keywords of the movie \"I Hope They Serve Beer in Hell\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.keyword_id) FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'I Hope They Serve Beer in Hell'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(T2.keyword_id) FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'I Hope They Serve Beer in Hell'",
"index": 212,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['I Hope They Serve Beer in Hell', 'Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"I Hope They Serve Beer in Hell\" refers to title = 'I Hope They Serve Beer in Hell';\nShow the total number of keywords of the movie \"I Hope They Serve Beer in Hell\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director', 'Director of Photography']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['director', 'dead', 'job', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Land of the Dead', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Land of the Dead\" refers to title = 'Land of the Dead'; director refers to person_name where job = 'Director'\nFor the movie \"Land of the Dead\", who is its director?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Land of the Dead' AND T2.job = 'Director'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Land of the Dead' AND T2.job = 'Director'",
"index": 213,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director', 'Director of Photography']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['director', 'dead', 'job', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Land of the Dead', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Land of the Dead\" refers to title = 'Land of the Dead'; director refers to person_name where job = 'Director'\nFor the movie \"Land of the Dead\", who is its director?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['animation', 'movies', 'b movie', 'numbers', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Made', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Paramount Animation', 'Paramount', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nParamount Animation refers to company_name = 'Paramount Animation'\nTell the number of movies made by Paramount Animation.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.movie_id) FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id WHERE T1.company_name = 'Paramount Animation'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(T2.movie_id) FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id WHERE T1.company_name = 'Paramount Animation'",
"index": 214,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['animation', 'movies', 'b movie', 'numbers', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Made', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Paramount Animation', 'Paramount', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nParamount Animation refers to company_name = 'Paramount Animation'\nTell the number of movies made by Paramount Animation.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Character', 'Spider', 'Female', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Spider-Man 3', 'Spider-Man', 'Spider', 'Spider-Man 2', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Female', 'Unspecified']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Characters', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale characters refer to gender = 'Female'; \"Spider-Man 3\" refers to title = 'Spider-Man 3'\nHow many female characters are there in the movie \"Spider-Man 3\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Spider-Man 3' AND T3.gender = 'Female'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(*) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Spider-Man 3' AND T3.gender = 'Female'",
"index": 215,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Character', 'Spider', 'Female', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Spider-Man 3', 'Spider-Man', 'Spider', 'Spider-Man 2', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Female', 'Unspecified']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Characters', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale characters refer to gender = 'Female'; \"Spider-Man 3\" refers to title = 'Spider-Man 3'\nHow many female characters are there in the movie \"Spider-Man 3\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director', 'Director of Photography']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Jaume Collet-Serra', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirected by refers to job = 'Director'; average budget = AVG(budget)\nCalculate the average budget of the movies directed by Jaume Collet-Serra.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T1.budget) AS REAL) / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Jaume Collet-Serra' AND T2.job = 'Director'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT CAST(SUM(T1.budget) AS REAL) / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Jaume Collet-Serra' AND T2.job = 'Director'",
"index": 216,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director', 'Director of Photography']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Jaume Collet-Serra', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirected by refers to job = 'Director'; average budget = AVG(budget)\nCalculate the average budget of the movies directed by Jaume Collet-Serra.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Characters', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Male', 'Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Bride Wars', 'War', 'Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['War', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender = 'Male'; \"Bride Wars\" refers to title = 'Bride Wars'; percentage = divide(sum(gender = 'Male'), count(gender)) * 100 as percentage\nWhat is the percentage of male characters in the movie \"Bride Wars\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T3.gender = 'Male' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T3.gender) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Bride Wars'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T3.gender = 'Male' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T3.gender) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Bride Wars'",
"index": 217,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Characters', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Male', 'Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Bride Wars', 'War', 'Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['War', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender = 'Male'; \"Bride Wars\" refers to title = 'Bride Wars'; percentage = divide(sum(gender = 'Male'), count(gender)) * 100 as percentage\nWhat is the percentage of male characters in the movie \"Bride Wars\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['money', 'b movie', 'what if', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Made', 'Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmade with the most money and resources refers to max(budget)\nWhat is the title of the movie that was made with the most money and resources?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM movie ORDER BY budget DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT title FROM movie ORDER BY budget DESC LIMIT 1",
"index": 218,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['money', 'b movie', 'what if', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Made', 'Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmade with the most money and resources refers to max(budget)\nWhat is the title of the movie that was made with the most money and resources?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhen the first movie refers to release_date where min(release_date)\nWhen was the first movie released?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT MIN(release_date) FROM movie WHERE movie_status = 'Released'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT MIN(release_date) FROM movie WHERE movie_status = 'Released'",
"index": 219,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhen the first movie refers to release_date where min(release_date)\nWhen was the first movie released?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Walt Disney', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['popularity', 'popular', 'what if', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Walt Disney Pictures', 'Walt Disney', 'Disney', 'Lucasfilm']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWalt Disney Pictures refers to company_name = 'Walt Disney Pictures'; most popular movie refers to max(popularity)\nWhat is Walt Disney Pictures' most popular movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Walt Disney Pictures' ORDER BY T3.popularity DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Walt Disney Pictures' ORDER BY T3.popularity DESC LIMIT 1",
"index": 220,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Walt Disney', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['popularity', 'popular', 'what if', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Walt Disney Pictures', 'Walt Disney', 'Disney', 'Lucasfilm']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWalt Disney Pictures refers to company_name = 'Walt Disney Pictures'; most popular movie refers to max(popularity)\nWhat is Walt Disney Pictures' most popular movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Crew', 'Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Washington', 'Mr. Smith', 'Female', 'Smith', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Mr. Smith Goes to Washington', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Female', 'Unspecified']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['gender', 'crew', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale crews refers to gender = 'Female'; \"Mr. Smith Goes to Washington\" refers to title = 'Mr. Smith Goes to Washington'\nHow many female crews are in the movie \"Mr. Smith Goes to Washington\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.gender) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Mr. Smith Goes to Washington' AND T3.gender = 'Female'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(T3.gender) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Mr. Smith Goes to Washington' AND T3.gender = 'Female'",
"index": 221,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Crew', 'Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Washington', 'Mr. Smith', 'Female', 'Smith', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Mr. Smith Goes to Washington', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Female', 'Unspecified']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['gender', 'crew', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale crews refers to gender = 'Female'; \"Mr. Smith Goes to Washington\" refers to title = 'Mr. Smith Goes to Washington'\nHow many female crews are in the movie \"Mr. Smith Goes to Washington\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Harrison Ford', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many movies did Harrison Ford appear in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Harrison Ford'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Harrison Ford'",
"index": 222,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Harrison Ford', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many movies did Harrison Ford appear in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Jamie Foxx', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost recent movie refers to max(release_date)\nWhat is the title of Jamie Foxx's most recent movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Jamie Foxx' ORDER BY T1.release_date DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Jamie Foxx' ORDER BY T1.release_date DESC LIMIT 1",
"index": 223,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Jamie Foxx', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost recent movie refers to max(release_date)\nWhat is the title of Jamie Foxx's most recent movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Crime', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst crime movie ever released refers to min(release_date) and genre_name = 'Crime'\nWhat is the title of the first crime movie ever released?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Crime' ORDER BY T1.release_date LIMIT 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Crime' ORDER BY T1.release_date LIMIT 1",
"index": 224,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Crime', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst crime movie ever released refers to min(release_date) and genre_name = 'Crime'\nWhat is the title of the first crime movie ever released?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Horror', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhorror movies refers to genre_name = 'Horror'\nHow many horror movies are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_id) FROM movie_genres AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.genre_id WHERE T2.genre_name = 'Horror'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(T1.movie_id) FROM movie_genres AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.genre_id WHERE T2.genre_name = 'Horror'",
"index": 225,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Horror', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhorror movies refers to genre_name = 'Horror'\nHow many horror movies are there?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Second Film Editor', 'Editor', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Editor', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsecond film editors refers to job = 'Second Film Editor'; Movie No. 12 refers to movie_id = 12\nList the person IDs of the second film editors in Movie No. 12.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT person_id FROM movie_crew WHERE movie_id = 12 AND job = 'Second Film Editor'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT person_id FROM movie_crew WHERE movie_id = 12 AND job = 'Second Film Editor'",
"index": 226,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Second Film Editor', 'Editor', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Editor', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsecond film editors refers to job = 'Second Film Editor'; Movie No. 12 refers to movie_id = 12\nList the person IDs of the second film editors in Movie No. 12.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['animation', 'job', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Animation', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Animation', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nanimators refers to job = 'Animation'; Movie No. 129 refers to movie_id = 129\nHow many animators does Movie No. 129 have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(movie_id) FROM movie_crew WHERE movie_id = 129 AND job = 'Animation'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(movie_id) FROM movie_crew WHERE movie_id = 129 AND job = 'Animation'",
"index": 227,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['animation', 'job', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Animation', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Animation', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nanimators refers to job = 'Animation'; Movie No. 129 refers to movie_id = 129\nHow many animators does Movie No. 129 have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Please Give', 'Four Rooms', 'Star Wars']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMovie No. 19 refers to movie_id = 19; Department No. 7 refers to department_id = 7\nIn Movie No. 19, how many people are there in Department No. 7? Please give me their job.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT job) FROM movie_crew WHERE movie_id = 19 AND department_id = 7",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT job) FROM movie_crew WHERE movie_id = 19 AND department_id = 7",
"index": 228,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Please Give', 'Four Rooms', 'Star Wars']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMovie No. 19 refers to movie_id = 19; Department No. 7 refers to department_id = 7\nIn Movie No. 19, how many people are there in Department No. 7? Please give me their job.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Jim Carrey', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Character', 'Star', 'Jim', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTally the movie ID and character name in the movie starring Jim Carrey.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.movie_id, T2.character_name FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Jim Carrey'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T2.movie_id, T2.character_name FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Jim Carrey'",
"index": 229,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Jim Carrey', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Character', 'Star', 'Jim', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTally the movie ID and character name in the movie starring Jim Carrey.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Thurman', 'Star', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Uma Thurman', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['star', 'film', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleased between 1/2/1990 and 12/30/2000 refers to release_date BETWEEN '1990-01-02' AND '2000-12-30'; film has the same meaning as movie; starred Uma Thurman refers to person_name = 'Uma Thurman'\nHow many films released between 1/2/1990 and 12/30/2000 starred Uma Thurman?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_id) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Uma Thurman' AND T1.release_date BETWEEN '1990-01-01' AND '2000-12-31'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Uma Thurman' AND T1.release_date BETWEEN '1990-01-01' AND '2000-12-31'",
"index": 230,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Thurman', 'Star', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Uma Thurman', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['star', 'film', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreleased between 1/2/1990 and 12/30/2000 refers to release_date BETWEEN '1990-01-02' AND '2000-12-30'; film has the same meaning as movie; starred Uma Thurman refers to person_name = 'Uma Thurman'\nHow many films released between 1/2/1990 and 12/30/2000 starred Uma Thurman?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['#Horror', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['horror', 'vote', 'film', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Horror', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhorror films refers to genre_name = 'Horror'; vote average of more than 7 refers to vote_average > 7\nWrite the titles of horror films with a vote average of more than 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 T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Horror' AND vote_average > 7",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Horror' AND vote_average > 7",
"index": 231,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['#Horror', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['horror', 'vote', 'film', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Horror', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhorror films refers to genre_name = 'Horror'; vote average of more than 7 refers to vote_average > 7\nWrite the titles of horror films with a vote average of more than 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 department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['India', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndian movies refers to country_name = 'India'; between 1/2/1990 and 12/30/2003 refers to release_date BETWEEN '1990-01-02' AND '2003-12-30'; revenue of more than 75,000,000 refers to revenue > 75000000; popularity of no less than 20 refers to popularity > = 20\nHow many Indian movies between 1/2/1990 and 12/30/2003 have revenue of more than 75,000,000 and popularity of no less than 20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.movie_id) FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id WHERE T1.revenue > 75000000 AND T1.popularity >= 20 AND T1.release_date BETWEEN '1990-01-01' AND '2003-12-31'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(T2.movie_id) FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id WHERE T1.revenue > 75000000 AND T1.popularity >= 20 AND T1.release_date BETWEEN '1990-01-01' AND '2003-12-31'",
"index": 232,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['India', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIndian movies refers to country_name = 'India'; between 1/2/1990 and 12/30/2003 refers to release_date BETWEEN '1990-01-02' AND '2003-12-30'; revenue of more than 75,000,000 refers to revenue > 75000000; popularity of no less than 20 refers to popularity > = 20\nHow many Indian movies between 1/2/1990 and 12/30/2003 have revenue of more than 75,000,000 and popularity of no less than 20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Indian', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['american', 'count', 'india', 'film', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['American Films', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United States of America', 'India', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2016 refers to release_date LIKE '2016%'; Indian and American films refers to country_name = 'India' and country_name = 'United States of America'; gap between the average revenue refers to subtract(divide(sum(revenue), count(movie_id)) when country_name = 'United States of America', divide(sum(revenue), count(movie_id)) when country_name = 'India')\nCalculate the 2016 gap between the average revenue for Indian and American films.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(CASE WHEN T3.COUNTry_name = 'United States of America' THEN T1.revenue END) - AVG(CASE WHEN T3.COUNTry_name = 'India' THEN T1.revenue END) AS CALCULATE FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE CAST(STRFTIME('%Y', T1.release_date) AS INT) = 2016",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT AVG(CASE WHEN T3.COUNTry_name = 'United States of America' THEN T1.revenue END) - AVG(CASE WHEN T3.COUNTry_name = 'India' THEN T1.revenue END) AS CALCULATE FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE CAST(STRFTIME('%Y', T1.release_date) AS INT) = 2016",
"index": 233,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Indian', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['american', 'count', 'india', 'film', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['American Films', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United States of America', 'India', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n2016 refers to release_date LIKE '2016%'; Indian and American films refers to country_name = 'India' and country_name = 'United States of America'; gap between the average revenue refers to subtract(divide(sum(revenue), count(movie_id)) when country_name = 'United States of America', divide(sum(revenue), count(movie_id)) when country_name = 'India')\nCalculate the 2016 gap between the average revenue for Indian and American films.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['USAF Master Sgt. Epps', 'Character', 'Master', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['gender', 'master', 'what if', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter 'USAF Master Sgt. Epps' refers to character_name = 'USAF Master Sgt. Epps'\nWhat is the gender of the character 'USAF Master Sgt. Epps?'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.gender FROM movie_cast AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.gender_id WHERE T1.character_name = 'USAF Master Sgt. Epps'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T2.gender FROM movie_cast AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.gender_id WHERE T1.character_name = 'USAF Master Sgt. Epps'",
"index": 234,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['USAF Master Sgt. Epps', 'Character', 'Master', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['gender', 'master', 'what if', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacter 'USAF Master Sgt. Epps' refers to character_name = 'USAF Master Sgt. Epps'\nWhat is the gender of the character 'USAF Master Sgt. Epps?'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Sky Captain and the World of Tomorrow', 'Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Sky Captain', 'Captain', 'Sky', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['captain', 'world', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngenres refers to genre_name; Sky Captain and the World of Tomorrow refers to title = 'Sky Captain and the World of Tomorrow'\nWhat are the genres of Sky Captain and the World of Tomorrow?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.title = 'Sky Captain and the World of Tomorrow'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.title = 'Sky Captain and the World of Tomorrow'",
"index": 235,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Sky Captain and the World of Tomorrow', 'Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Sky Captain', 'Captain', 'Sky', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['captain', 'world', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngenres refers to genre_name; Sky Captain and the World of Tomorrow refers to title = 'Sky Captain and the World of Tomorrow'\nWhat are the genres of Sky Captain and the World of Tomorrow?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['captain', 'world', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Sky Captain', 'Captain', 'Sky', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Sky Captain and the World of Tomorrow', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nkeywords refers to keyword_name; movie 'Sky Captain and the World of Tomorrow' refers to title = 'Sky Captain and the World of Tomorrow'\nWrite all the keywords belonging to the movie 'Sky Captain and the World of Tomorrow.'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.keyword_name FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T1.title = 'Sky Captain and the World of Tomorrow'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.keyword_name FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T1.title = 'Sky Captain and the World of Tomorrow'",
"index": 236,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['captain', 'world', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Sky Captain', 'Captain', 'Sky', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Sky Captain and the World of Tomorrow', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nkeywords refers to keyword_name; movie 'Sky Captain and the World of Tomorrow' refers to title = 'Sky Captain and the World of Tomorrow'\nWrite all the keywords belonging to the movie 'Sky Captain and the World of Tomorrow.'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Gojira ni-sen mireniamu', 'Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovie 'Gojira ni-sen mireniamu' refers to title = 'Gojira ni-sen mireniamu'; which country refers to country_name\nThe movie 'Gojira ni-sen mireniamu' is from which country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.COUNTry_name FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T1.title = 'Gojira ni-sen mireniamu'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.COUNTry_name FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T1.title = 'Gojira ni-sen mireniamu'",
"index": 237,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Gojira ni-sen mireniamu', 'Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovie 'Gojira ni-sen mireniamu' refers to title = 'Gojira ni-sen mireniamu'; which country refers to country_name\nThe movie 'Gojira ni-sen mireniamu' is from which country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['France', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance refers to country_name = 'France'\nList 10 movie titles that were produced in France.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T3.COUNTry_name = 'France' LIMIT 10",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.title FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T3.COUNTry_name = 'France' LIMIT 10",
"index": 238,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['France', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance refers to country_name = 'France'\nList 10 movie titles that were produced in France.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Mad Max: Fury Road', 'Mad Max', 'Fury', 'Max', 'Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncrews refers to person_name; movie 'Mad Max: Fury Road' refers to title = 'Mad Max: Fury Road'\nList 10 crews alongside their jobs who worked on the movie 'Mad Max: Fury Road.'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Mad Max: Fury Road' LIMIT 10",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Mad Max: Fury Road' LIMIT 10",
"index": 239,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Mad Max: Fury Road', 'Mad Max', 'Fury', 'Max', 'Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncrews refers to person_name; movie 'Mad Max: Fury Road' refers to title = 'Mad Max: Fury Road'\nList 10 crews alongside their jobs who worked on the movie 'Mad Max: Fury Road.'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Animation', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['animation', 'movies', 'count', 'japan', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Animation', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['Japan', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom Japan refers to country_name = 'Japan'; in the 'animation' genre refers to genre_name = 'animation'; percentage = divide(sum(movie_id) when genre_name = 'animation', count(movie_id)) as percentage\nWhat percentage of movies that came from Japan belong in the 'animation' genre?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T4.genre_name = 'Animation' THEN T1.movie_id ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN production_COUNTry AS T3 ON T1.movie_id = T3.movie_id INNER JOIN genre AS T4 ON T2.genre_id = T4.genre_id INNER JOIN COUNTry AS T5 ON T3.COUNTry_id = T5.COUNTry_id WHERE T5.COUNTry_name = 'Japan'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T4.genre_name = 'Animation' THEN T1.movie_id ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN production_COUNTry AS T3 ON T1.movie_id = T3.movie_id INNER JOIN genre AS T4 ON T2.genre_id = T4.genre_id INNER JOIN COUNTry AS T5 ON T3.COUNTry_id = T5.COUNTry_id WHERE T5.COUNTry_name = 'Japan'",
"index": 240,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Animation', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['animation', 'movies', 'count', 'japan', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Animation', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['Japan', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom Japan refers to country_name = 'Japan'; in the 'animation' genre refers to genre_name = 'animation'; percentage = divide(sum(movie_id) when genre_name = 'animation', count(movie_id)) as percentage\nWhat percentage of movies that came from Japan belong in the 'animation' genre?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Iron Man', 'Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['iron man', 'gender', 'count', 'iron', 'male', 'what if']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female', 'Male']\n PRIMARY KEY (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender = 'Male'; female refers to gender = 'Female'; movie 'Iron Man' refers to title = 'Iron Man'; ratio = divide(sum(gender = 'Female'), sum(gender = 'Male'))\nWhat is the ratio between male and female cast members of the movie 'Iron Man?' Count how many have unspecified genders.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T3.gender = 'Male' THEN 1 ELSE NULL END) AS REAL) / COUNT(CASE WHEN T3.gender = 'Female' THEN 1 ELSE NULL END) AS RATIO , COUNT(CASE WHEN T3.gender = 'Unspecified' THEN 1 ELSE NULL END) AS UNGENDERS FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Iron Man'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T3.gender = 'Male' THEN 1 ELSE NULL END) AS REAL) / COUNT(CASE WHEN T3.gender = 'Female' THEN 1 ELSE NULL END) AS RATIO , COUNT(CASE WHEN T3.gender = 'Unspecified' THEN 1 ELSE NULL END) AS UNGENDERS FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Iron Man'",
"index": 241,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Iron Man', 'Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['iron man', 'gender', 'count', 'iron', 'male', 'what if']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female', 'Male']\n PRIMARY KEY (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to gender = 'Male'; female refers to gender = 'Female'; movie 'Iron Man' refers to title = 'Iron Man'; ratio = divide(sum(gender = 'Female'), sum(gender = 'Male'))\nWhat is the ratio between male and female cast members of the movie 'Iron Man?' Count how many have unspecified genders.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Angel', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['angel', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nkeyword of \"angel\" refers to keyword_name = 'angel'\nLook for the movie title with the keyword of \"angel\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'angel'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'angel'",
"index": 242,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Angel', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['angel', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nkeyword of \"angel\" refers to keyword_name = 'angel'\nLook for the movie title with the keyword of \"angel\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['id', 'en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['knight', 'dark', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['The Dark Knight', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovie with the title of \"The Dark Knight\" refers to title = 'The Dark Knight'\nProvide the genre ID of the movie with the title of \"The Dark Knight\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.genre_id FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'The Dark Knight'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T2.genre_id FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'The Dark Knight'",
"index": 243,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['id', 'en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['knight', 'dark', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['The Dark Knight', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovie with the title of \"The Dark Knight\" refers to title = 'The Dark Knight'\nProvide the genre ID of the movie with the title of \"The Dark Knight\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n revenue integer, -- example: [4300000, 775398007]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Thriller', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngenre of thriller refers to genre_name = 'Thriller'\nList down the movie titles within the genre of thriller.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Thriller'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Thriller'",
"index": 244,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n revenue integer, -- example: [4300000, 775398007]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Thriller', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngenre of thriller refers to genre_name = 'Thriller'\nList down the movie titles within the genre of thriller.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['drama', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Drama', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrumoured movie refers to movie_status = 'rumoured'; genre of Drama refers to genre_name = 'Drama'\nWrite down five rumoured movie titles within the genre of Drama.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.movie_status = 'Rumored' AND T3.genre_name = 'Drama' LIMIT 5",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.movie_status = 'Rumored' AND T3.genre_name = 'Drama' LIMIT 5",
"index": 245,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['drama', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Drama', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrumoured movie refers to movie_status = 'rumoured'; genre of Drama refers to genre_name = 'Drama'\nWrite down five rumoured movie titles within the genre of Drama.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngenre refers to genre_name; runtime of only 14 minutes refers to runtime = 14\nState the genre of the movie title with a runtime of only 14 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 T3.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.runtime = 14",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.runtime = 14",
"index": 246,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngenre refers to genre_name; runtime of only 14 minutes refers to runtime = 14\nState the genre of the movie title with a runtime of only 14 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 production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['ID', 'AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['id', 'en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Dead Man', 'Pirate', 'Man', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntitle of \"Pirates of the Caribbean: Dead Man's Chest\" refers to title = 'Pirates of the Caribbean: Dead Man''s Chest'\nWhat is the country ID of the movie with the title of \"Pirates of the Caribbean: Dead Man's Chest\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.COUNTry_id FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title LIKE 'Pirates of the Caribbean: Dead Man%s Chest'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T2.COUNTry_id FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title LIKE 'Pirates of the Caribbean: Dead Man%s Chest'",
"index": 247,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['ID', 'AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['id', 'en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Dead Man', 'Pirate', 'Man', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntitle of \"Pirates of the Caribbean: Dead Man's Chest\" refers to title = 'Pirates of the Caribbean: Dead Man''s Chest'\nWhat is the country ID of the movie with the title of \"Pirates of the Caribbean: Dead Man's Chest\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['canada', 'list', 'producer', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['Canada', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Producer', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduced in Canada refers to country_name = 'Canada'\nList down the movie titles that were produced in Canada.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T3.COUNTry_name = 'Canada'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.title FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T3.COUNTry_name = 'Canada'",
"index": 248,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['canada', 'list', 'producer', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['Canada', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Producer', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduced in Canada refers to country_name = 'Canada'\nList down the movie titles that were produced in Canada.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['video game', 'video', 'game', 'video gamer', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nkeyword of \"video game\" refers to keyword_name = 'video game'\nAccumulate the budget of the movie titles with the keyword of \"video game\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.budget) FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'video game'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT SUM(T1.budget) FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'video game'",
"index": 249,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['video game', 'video', 'game', 'video gamer', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nkeyword of \"video game\" refers to keyword_name = 'video game'\nAccumulate the budget of the movie titles with the keyword of \"video game\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['civil war', 'movies', 'war', 'general', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['War', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['War', 'Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nkeyword of \"civil war\" refers to keyword_name = 'civil war'; average revenue = AVG(revenue)\nFor movies with the keyword of \"civil war\", calculate the average revenue generated by these movies.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T1.revenue) FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'civil war'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT AVG(T1.revenue) FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'civil war'",
"index": 250,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['civil war', 'movies', 'war', 'general', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['War', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['War', 'Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nkeyword of \"civil war\" refers to keyword_name = 'civil war'; average revenue = AVG(revenue)\nFor movies with the keyword of \"civil war\", calculate the average revenue generated by these movies.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['One', 'Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Made', 'Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nzero-budget refers to budget = 0; highest revenue refers to max(revenue)\nAmong the zero-budget movie titles, which one has made the highest revenue?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM movie WHERE budget = 0 ORDER BY revenue DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT title FROM movie WHERE budget = 0 ORDER BY revenue DESC LIMIT 1",
"index": 251,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['One', 'Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Made', 'Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nzero-budget refers to budget = 0; highest revenue refers to max(revenue)\nAmong the zero-budget movie titles, which one has made the highest revenue?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Gladiator', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['The Production Company', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['gladiator', 'company', 'producer', 'what if', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['ID', 'AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['id', 'en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Producer', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Producer', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID of the production company refers to company_id; movie \"Gladiator\" refers to title = 'Gladiator'\nWhat is the ID of the production company which produced the movie \"Gladiator\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.company_id FROM movie AS T1 INNER JOIN movie_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'Gladiator'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T2.company_id FROM movie AS T1 INNER JOIN movie_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'Gladiator'",
"index": 252,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Gladiator', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['The Production Company', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['gladiator', 'company', 'producer', 'what if', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['ID', 'AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['id', 'en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Producer', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Producer', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID of the production company refers to company_id; movie \"Gladiator\" refers to title = 'Gladiator'\nWhat is the ID of the production company which produced the movie \"Gladiator\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['id', 'en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['ID', 'AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Walk the Line', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['what if', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovie \"Walk the Line\" refers to title = 'Walk the Line'\nWhat is the language ID of the movie \"Walk the 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 T2.language_id FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'Walk the Line'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T2.language_id FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'Walk the Line'",
"index": 253,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['id', 'en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['ID', 'AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Walk the Line', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['what if', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovie \"Walk the Line\" refers to title = 'Walk the Line'\nWhat is the language ID of the movie \"Walk the 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 movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['ID', 'AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['popularity', 'popular', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['id', 'en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest popularity refers to max(popularity)\nFind out the language ID of the movie with the highest popularity.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.language_id FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.popularity DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T2.language_id FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.popularity DESC LIMIT 1",
"index": 254,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['ID', 'AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['popularity', 'popular', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['id', 'en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest popularity refers to max(popularity)\nFind out the language ID of the movie with the highest popularity.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['movies', 'post', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Production', 'Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Post Production', 'Released', 'Rumored']\n tagline text, -- example: ['nederlands', 'Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['Nederlands', 'English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npost-production movies refers to movie_status = 'Post Production'; Nederlands refers to language_name = 'Nederlands';\nAre there any post-production movies in Nederlands?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 CASE WHEN T1.movie_status = 'Post Production' THEN 'YES' ELSE 'NO' END AS YORN FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id WHERE T3.language_name = 'Nederlands'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT DISTINCT CASE WHEN T1.movie_status = 'Post Production' THEN 'YES' ELSE 'NO' END AS YORN FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id WHERE T3.language_name = 'Nederlands'",
"index": 255,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['movies', 'post', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Production', 'Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Post Production', 'Released', 'Rumored']\n tagline text, -- example: ['nederlands', 'Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['Nederlands', 'English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npost-production movies refers to movie_status = 'Post Production'; Nederlands refers to language_name = 'Nederlands';\nAre there any post-production movies in Nederlands?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['Polski', 'English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['movies', 'list', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPolski movies refers to language_name = 'Polski'\nList down the tagline of the Polski movies.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.tagline FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id WHERE T3.language_name = 'Polski'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT DISTINCT T1.tagline FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id WHERE T3.language_name = 'Polski'",
"index": 256,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['Polski', 'English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['movies', 'list', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPolski movies refers to language_name = 'Polski'\nList down the tagline of the Polski movies.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Live Entertainment', 'Entertainment', 'Fantasy Films', 'On Entertainment', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmade by Fantasy Films refers to company_name = 'Fantasy Films'; Live Entertainment refers to company_name = 'Live Entertainment'\nCalculate the revenues made by Fantasy Films and Live Entertainment.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.revenue) FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name IN ('Fantasy Films', 'Live Entertainment')",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT SUM(T3.revenue) FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name IN ('Fantasy Films', 'Live Entertainment')",
"index": 257,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Live Entertainment', 'Entertainment', 'Fantasy Films', 'On Entertainment', 'Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmade by Fantasy Films refers to company_name = 'Fantasy Films'; Live Entertainment refers to company_name = 'Live Entertainment'\nCalculate the revenues made by Fantasy Films and Live Entertainment.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['movies', 'what if', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['Latin', 'English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLatin movies refers to language_name = 'Latin'; average revenue = AVG(revenue)\nWhat is the average revenue made by Latin movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T1.revenue) FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id WHERE T3.language_name = 'Latin'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT AVG(T1.revenue) FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id WHERE T3.language_name = 'Latin'",
"index": 258,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['movies', 'what if', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['Latin', 'English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLatin movies refers to language_name = 'Latin'; average revenue = AVG(revenue)\nWhat is the average revenue made by Latin movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Common', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['count', 'what if', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Common', 'Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost common first name refers to max(count(person_name))\nWhat is the most common first name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT person_name FROM person GROUP BY person_name ORDER BY COUNT(person_name) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT person_name FROM person GROUP BY person_name ORDER BY COUNT(person_name) DESC LIMIT 1",
"index": 259,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Common', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['count', 'what if', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Common', 'Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost common first name refers to max(count(person_name))\nWhat is the most common first name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage number of crews = divide(count(person_id), COUNT(movie_id))\nWhat is the average number of crews for a movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CD) AS REAL) / COUNT(movie_id) FROM ( SELECT movie_id, COUNT(person_id) AS CD FROM movie_crew GROUP BY movie_id )",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT CAST(SUM(CD) AS REAL) / COUNT(movie_id) FROM ( SELECT movie_id, COUNT(person_id) AS CD FROM movie_crew GROUP BY movie_id )",
"index": 260,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage number of crews = divide(count(person_id), COUNT(movie_id))\nWhat is the average number of crews for a movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest runtime refers to max(runtime)\nWhat is the longest runtime of all movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT MAX(runtime) FROM movie",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT MAX(runtime) FROM movie",
"index": 261,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlongest runtime refers to max(runtime)\nWhat is the longest runtime of all movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['Kyrgyz Republic', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\niso code refers to country_iso_code; \"Kyrgyz Republic\" refers to country_name = 'Kyrgyz Republic'\nWhat is the iso code of \"Kyrgyz Republic\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNTry_iso_code FROM COUNTry WHERE COUNTry_name = 'Kyrgyz Republic'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNTry_iso_code FROM COUNTry WHERE COUNTry_name = 'Kyrgyz Republic'",
"index": 262,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['Kyrgyz Republic', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\niso code refers to country_iso_code; \"Kyrgyz Republic\" refers to country_name = 'Kyrgyz Republic'\nWhat is the iso code of \"Kyrgyz Republic\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Vi', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n runtime integer, -- example: [98, 121]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['vi', 'en', 'sv']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"vi\" as their language code refers to language_code = 'vi'\nHow many movies have \"vi\" as their language code?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_id) FROM movie_languages AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_code = 'vi'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(T1.movie_id) FROM movie_languages AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_code = 'vi'",
"index": 263,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Vi', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n runtime integer, -- example: [98, 121]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['vi', 'en', 'sv']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"vi\" as their language code refers to language_code = 'vi'\nHow many movies have \"vi\" as their language code?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Common', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['count', 'what if', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast common genre refers to min(count(genre_name))\nWhat is the third least common genre?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.genre_name FROM movie_genres AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.genre_id GROUP BY T2.genre_id ORDER BY COUNT(T1.movie_id) LIMIT 2, 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T2.genre_name FROM movie_genres AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.genre_id GROUP BY T2.genre_id ORDER BY COUNT(T1.movie_id) LIMIT 2, 1",
"index": 264,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Common', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['count', 'what if', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast common genre refers to min(count(genre_name))\nWhat is the third least common genre?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['France', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrench movies refers to country_name = 'France'; average revenue = AVG(revenue)\nProvide the average revenue of all the French movies.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T1.revenue) FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T3.COUNTry_name = 'France'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT AVG(T1.revenue) FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T3.COUNTry_name = 'France'",
"index": 265,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['France', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrench movies refers to country_name = 'France'; average revenue = AVG(revenue)\nProvide the average revenue of all the French movies.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Character', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Characters', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['gender', 'list', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacters refers to character_name; gender = 'Unspecified'\nList all the unspecified gender characters.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.character_name FROM movie_cast AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.gender_id WHERE T2.gender = 'Unspecified'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.character_name FROM movie_cast AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.gender_id WHERE T2.gender = 'Unspecified'",
"index": 266,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Character', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Characters', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['gender', 'list', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncharacters refers to character_name; gender = 'Unspecified'\nList all the unspecified gender characters.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['count', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndepartment refers to department_name; most people refers to max(count(department_id))\nWhich department has the most people?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.department_name FROM department AS T1 INNER JOIN movie_crew AS T2 ON T1.department_id = T2.department_id GROUP BY T1.department_id ORDER BY COUNT(T2.department_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.department_name FROM department AS T1 INNER JOIN movie_crew AS T2 ON T1.department_id = T2.department_id GROUP BY T1.department_id ORDER BY COUNT(T2.department_id) DESC LIMIT 1",
"index": 267,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['count', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndepartment refers to department_name; most people refers to max(count(department_id))\nWhich department has the most people?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Female', 'Male', 'Unspecified']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['actors', 'gender', 'actor', 'count', 'male', 'b movie']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Actors', 'Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Female', 'Actor', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to gender = 'Female';male refers to gender = 'Male'; average ratio = divide(divide(sum(gender_id) when gender = 'Female', sum(gender_id) when gender = 'Male'), count(movie_id)) as percentage\nWhat is the average ratio between female and male actors in a movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(CASE WHEN T2.gender = 'Female' THEN T1.person_id ELSE NULL END) AS REAL) / COUNT(CASE WHEN T2.gender = 'Male' THEN T1.person_id ELSE NULL END) FROM movie_cast AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.gender_id",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.gender = 'Female' THEN T1.person_id ELSE NULL END) AS REAL) / COUNT(CASE WHEN T2.gender = 'Male' THEN T1.person_id ELSE NULL END) FROM movie_cast AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.gender_id",
"index": 268,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Female', 'Male', 'Unspecified']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['actors', 'gender', 'actor', 'count', 'male', 'b movie']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Actors', 'Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Female', 'Actor', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to gender = 'Female';male refers to gender = 'Male'; average ratio = divide(divide(sum(gender_id) when gender = 'Female', sum(gender_id) when gender = 'Male'), count(movie_id)) as percentage\nWhat is the average ratio between female and male actors in a movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the movies refers to title; released in 1945 refers to release_date LIKE '1945%'\nList the movies released in 1945.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM movie WHERE CAST(STRFTIME('%Y', release_date) AS INT) = 1945",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT title FROM movie WHERE CAST(STRFTIME('%Y', release_date) AS INT) = 1945",
"index": 269,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the movies refers to title; released in 1945 refers to release_date LIKE '1945%'\nList the movies released in 1945.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Catherine Deneuve', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Characters', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Catherine', 'Character', 'Baby Catherine', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['play', 'list', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the character names played by Catherine Deneuve.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.character_name FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Catherine Deneuve'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T2.character_name FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Catherine Deneuve'",
"index": 270,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Star Wars']\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['Catherine Deneuve', 'George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Characters', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Catherine', 'Character', 'Baby Catherine', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['play', 'list', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the character names played by Catherine Deneuve.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['popularity', 'popular', 'date', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlanguage refers to langauge_name; most popular movie refers to max(popularity)\nProvide the release date and language of the most popular movie.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.release_date, T3.language_name FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id ORDER BY T1.popularity DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.release_date, T3.language_name FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id ORDER BY T1.popularity DESC LIMIT 1",
"index": 271,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Max', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Max', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['popularity', 'popular', 'date', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlanguage refers to langauge_name; most popular movie refers to max(popularity)\nProvide the release date and language of the most popular movie.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Room', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['No Language', 'English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlanguage refers to language_name; original language refers to language_role = 'Original'; \"Four Rooms\" refers to title = 'Four Rooms'\nWhat is the original language of the \"Four Rooms\" movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.language_name FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id INNER JOIN language_role AS T4 ON T2.language_role_id = T4.role_id WHERE T4.language_role = 'Original' AND T1.title = 'Four Rooms'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.language_name FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id INNER JOIN language_role AS T4 ON T2.language_role_id = T4.role_id WHERE T4.language_role = 'Original' AND T1.title = 'Four Rooms'",
"index": 272,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Four Rooms', 'Room', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['No Language', 'English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlanguage refers to language_name; original language refers to language_role = 'Original'; \"Four Rooms\" refers to title = 'Four Rooms'\nWhat is the original language of the \"Four Rooms\" movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['caribbean', 'pirate', 'world', 'actor', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: [\"Pirates of the Caribbean: At World's End\", 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Pirate', 'Actor', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmain actor refers to person_name where Min(cast_order); \"Pirates of the Caribbean: At World's End\" refers to title = 'Pirates of the Caribbean: At World''s End'\nWho is the main actor in the \"Pirates of the Caribbean: At World's End\" movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' ORDER BY T2.cast_order LIMIT 1",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' ORDER BY T2.cast_order LIMIT 1",
"index": 273,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['caribbean', 'pirate', 'world', 'actor', 'b movie', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: [\"Pirates of the Caribbean: At World's End\", 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Pirate', 'Actor', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmain actor refers to person_name where Min(cast_order); \"Pirates of the Caribbean: At World's End\" refers to title = 'Pirates of the Caribbean: At World''s End'\nWho is the main actor in the \"Pirates of the Caribbean: At World's End\" movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Crew', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['supervisor', 'camera', 'crew', 'list', 'job', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['The Crew', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Camera Supervisor', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Supervisor', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_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 refers to person_name; camera supervisors refers to job = 'Camera Supervisor';\nList the names of camera supervisors in the crew.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person_name FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T2.job = 'Camera Supervisor'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T1.person_name FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T2.job = 'Camera Supervisor'",
"index": 274,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Adventure', 'Fantasy']\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Crew', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['supervisor', 'camera', 'crew', 'list', 'job', 'individual']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['The Crew', 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n release_date date, -- example: ['1995-12-09', '1977-05-25']\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Camera Supervisor', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE movie_keywords (\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Supervisor', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_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 refers to person_name; camera supervisors refers to job = 'Camera Supervisor';\nList the names of camera supervisors in the crew.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Pirate', 'Editor', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Music Editor', 'Editor', 'Music', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['caribbean', 'pirate', 'world', 'music', 'work', 'job']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: [\"Pirates of the Caribbean: At World's End\", 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Music', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_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 refers to person_name; departments refers to department_name; worked as a music editor refers to job = 'Music Editor'; \"Pirates of the Caribbean: At World's End\" refers to title = 'Pirates of the Caribbean: At World''s End'\nProvide the names and departments of the person who worked as a music editor in the \"Pirates of the Caribbean: At World's End\" movie.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.person_name, T4.department_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id INNER JOIN department AS T4 ON T2.department_id = T4.department_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Music Editor'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.person_name, T4.department_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id INNER JOIN department AS T4 ON T2.department_id = T4.department_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Music Editor'",
"index": 275,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Pirate', 'Editor', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n cast_order integer, -- example: [0, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Music Editor', 'Editor', 'Music', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['caribbean', 'pirate', 'world', 'music', 'work', 'job']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: [\"Pirates of the Caribbean: At World's End\", 'Four Rooms', 'Star Wars']\n budget integer, -- example: [4000000, 11000000]\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n genre_name text, -- example: ['Music', 'Adventure', 'Fantasy']\n PRIMARY KEY (genre_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 refers to person_name; departments refers to department_name; worked as a music editor refers to job = 'Music Editor'; \"Pirates of the Caribbean: At World's End\" refers to title = 'Pirates of the Caribbean: At World''s End'\nProvide the names and departments of the person who worked as a music editor in the \"Pirates of the Caribbean: At World's End\" movie.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['Canada', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['movies', 'canada', 'producer', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduced in Canada refers to country_name = 'Canada'\nHow many movies were produced in Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.movie_id) FROM COUNTry AS T1 INNER JOIN production_COUNTry AS T2 ON T1.COUNTry_id = T2.COUNTry_id WHERE T1.COUNTry_name = 'Canada'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT COUNT(T2.movie_id) FROM COUNTry AS T1 INNER JOIN production_COUNTry AS T2 ON T1.COUNTry_id = T2.COUNTry_id WHERE T1.COUNTry_name = 'Canada'",
"index": 276,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n department_name text, -- example: ['Camera', 'Directing']\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n homepage text, -- example: ['http://www.starwars.com/films/star-wars-', 'http://movies.disney.com/finding-nemo']\n popularity real, -- example: [22.87623, 126.393695]\n runtime integer, -- example: [98, 121]\n movie_status text, -- example: ['Released', 'Rumored']\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['Canada', 'United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['movies', 'canada', 'producer', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n company_id integer, -- example: [14, 59]\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_name text, -- example: ['English', 'svenska']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduced in Canada refers to country_name = 'Canada'\nHow many movies were produced in Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['independent film', 'woman director', 'director', 'movies', 'count', 'woman']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunder keywords of \"woman director\" and \"independent film\" refers to keyword_name = 'woman director' and keyword_name = 'independent film'; difference in percentage = divide(subtract(count(movie_id) when keyword_name = 'woman director', count(movie_id) when keyword_name = 'independent film'), count(movie_id)) as percentage\nFind the difference in percentage of the movies under keywords of \"woman director\" and \"independent film\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST((SUM(CASE WHEN T1.keyword_name = 'woman director' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.keyword_name = 'independent film' THEN 1 ELSE 0 END)) AS REAL) * 100 / SUM(CASE WHEN T1.keyword_name = 'independent film' THEN 1 ELSE 0 END) FROM keyword AS T1 INNER JOIN movie_keywords AS T2 ON T1.keyword_id = T2.keyword_id",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT CAST((SUM(CASE WHEN T1.keyword_name = 'woman director' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.keyword_name = 'independent film' THEN 1 ELSE 0 END)) AS REAL) * 100 / SUM(CASE WHEN T1.keyword_name = 'independent film' THEN 1 ELSE 0 END) FROM keyword AS T1 INNER JOIN movie_keywords AS T2 ON T1.keyword_id = T2.keyword_id",
"index": 277,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n gender text, -- example: ['Unspecified', 'Female']\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['independent film', 'woman director', 'director', 'movies', 'count', 'woman']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_iso_code text, -- example: ['AE', 'AF']\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunder keywords of \"woman director\" and \"independent film\" refers to keyword_name = 'woman director' and keyword_name = 'independent film'; difference in percentage = divide(subtract(count(movie_id) when keyword_name = 'woman director', count(movie_id) when keyword_name = 'independent film'), count(movie_id)) as percentage\nFind the difference in percentage of the movies under keywords of \"woman director\" and \"independent film\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Producer', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: [\"Pirates of the Caribbean: At World's End\", 'The Producers', 'Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n revenue integer, -- example: [4300000, 775398007]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the names refers to person_name; producers refers to job = 'Producer'; \"Pirates of the Caribbean: At World's End\" refers to title = 'Pirates of the Caribbean: The Curse of the Black Pearl'\nList the names of all the producers in the movie \"Pirates of the Caribbean: At World's End\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Pirates of the Caribbean: The Curse of the Black Pearl' AND T2.job = 'Producer'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Pirates of the Caribbean: The Curse of the Black Pearl' AND T2.job = 'Producer'",
"index": 278,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Producer', 'Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: [\"Pirates of the Caribbean: At World's End\", 'The Producers', 'Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n revenue integer, -- example: [4300000, 775398007]\n tagline text, -- example: ['Twelve outrageous guests. Four scandalou', 'A long time ago in a galaxy far, far awa']\n vote_average real, -- example: [6.5, 8.1]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n country_name text, -- example: ['United Arab Emirates', 'Afghanistan']\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the names refers to person_name; producers refers to job = 'Producer'; \"Pirates of the Caribbean: At World's End\" refers to title = 'Pirates of the Caribbean: The Curse of the Black Pearl'\nList the names of all the producers in the movie \"Pirates of the Caribbean: At World's End\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['movies', 'paris', 'list', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Paris', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Made', 'Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nincome refers to revenue; keyword \"paris\" refers to keyword_name = 'paris'; average income = AVG(revenue)\nCalculate the average income made by movies using the keyword \"paris\". List the title of the movies.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T1.revenue), T1.title FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'paris'",
"style": "rule"
} | {
"db_id": "movies_4.sqlite",
"gt_sql": "SELECT AVG(T1.revenue), T1.title FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'paris'",
"index": 279,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE keyword (\n keyword_id integer, -- example: [30, 65]\n keyword_name text, -- example: ['movies', 'paris', 'list', 'b movie', 'individual', 'holiday']\n PRIMARY KEY (keyword_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [24574, 24575]\n language_code text, -- example: ['en', 'sv']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE movie_cast (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [85, 114]\n character_name text, -- example: ['Paris', 'Captain Jack Sparrow', 'Will Turner']\n gender_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_cast_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_cast_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_cast_gender_id FOREIGN KEY (gender_id) REFERENCES gender (gender_id)\n);\n\nCREATE TABLE person (\n person_id integer, -- example: [1, 2]\n person_name text, -- example: ['George Lucas', 'Mark Hamill']\n PRIMARY KEY (person_id)\n);\n\nCREATE TABLE movie_crew (\n movie_id integer, -- example: [285, 559]\n person_id integer, -- example: [120, 1704]\n department_id integer, -- example: [1, 2]\n job text, -- example: ['Director of Photography', 'Director']\n CONSTRAINT fk_movie_crew_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_crew_person_id FOREIGN KEY (person_id) REFERENCES person (person_id),\n CONSTRAINT fk_movie_crew_department_id FOREIGN KEY (department_id) REFERENCES department (department_id)\n);\n\nCREATE TABLE gender (\n gender_id integer, -- example: [0, 1]\n PRIMARY KEY (gender_id)\n);\n\nCREATE TABLE genre (\n genre_id integer, -- example: [12, 14]\n PRIMARY KEY (genre_id)\n);\n\nCREATE TABLE movie (\n movie_id integer, -- example: [5, 11]\n title text, -- example: ['Made', 'Four Rooms', 'Star Wars']\n overview text, -- example: [\"It's Ted the Bellhop's first night on th\", 'Princess Leia is captured and held hosta']\n popularity real, -- example: [22.87623, 126.393695]\n revenue integer, -- example: [4300000, 775398007]\n vote_count integer, -- example: [530, 6624]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE production_country (\n movie_id integer, -- mivie id, example: [5, 11]\n country_id integer, -- example: [214, 131]\n CONSTRAINT fk_production_country_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_production_country_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE movie_keywords (\n movie_id integer, -- example: [5, 11]\n keyword_id integer, -- example: [612, 613]\n);\n\nCREATE TABLE department (\n department_id integer, -- example: [1, 2]\n PRIMARY KEY (department_id)\n);\n\nCREATE TABLE movie_company (\n movie_id integer, -- example: [5, 11]\n);\n\nCREATE TABLE movie_genres (\n movie_id integer, -- example: [5, 11]\n genre_id integer, -- example: [35, 80]\n CONSTRAINT fk_movie_genres_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_genres_genre_id FOREIGN KEY (genre_id) REFERENCES genre (genre_id)\n);\n\nCREATE TABLE language_role (\n role_id integer, -- example: [1, 2]\n language_role text, -- example: ['Original', 'Spoken']\n PRIMARY KEY (role_id)\n);\n\nCREATE TABLE movie_languages (\n movie_id integer, -- example: [5, 11]\n language_id integer, -- example: [24574, 24575]\n language_role_id integer, -- example: [2, 1]\n CONSTRAINT fk_movie_languages_movie_id FOREIGN KEY (movie_id) REFERENCES movie (movie_id),\n CONSTRAINT fk_movie_languages_language_id FOREIGN KEY (language_id) REFERENCES `language` (language_id),\n CONSTRAINT fk_movie_languages_language_role_id FOREIGN KEY (language_role_id) REFERENCES language_role (role_id)\n);\n\nCREATE TABLE production_company (\n company_id integer, -- example: [1, 2]\n company_name text, -- example: ['Lucasfilm', 'Walt Disney Pictures']\n PRIMARY KEY (company_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [128, 129]\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nincome refers to revenue; keyword \"paris\" refers to keyword_name = 'paris'; average income = AVG(revenue)\nCalculate the average income made by movies using the keyword \"paris\". List the title of the movies.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['solutionID', 'solutionId', 'SolutionId', 'highest', 'What', 'what']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest sampling time refers to max(SampledAt); id number of the solution refers to SolutionId;\nWhat is the time of sampling of the solution with the highest sampling time? Indicate the id number of the solution.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 SampledAt, SolutionId FROM Method WHERE SampledAt = ( SELECT MAX(SampledAt) FROM Method )",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT DISTINCT SampledAt, SolutionId FROM Method WHERE SampledAt = ( SELECT MAX(SampledAt) FROM Method )",
"index": 280,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['solutionID', 'solutionId', 'SolutionId', 'highest', 'What', 'what']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest sampling time refers to max(SampledAt); id number of the solution refers to SolutionId;\nWhat is the time of sampling of the solution with the highest sampling time? Indicate the id number of the solution.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Summary text, -- example: ['Amount', 'Converts the query expression into text ', 'Execute the query expression ']\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore stars mean more people like this repository; most liked refers to max(Stars); the github address of repository refers to Url;\nWhat is the most liked repository? Indicate its github address and the amount of stars it has received.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Url, Stars FROM Repo WHERE Stars = ( SELECT MAX(Stars) FROM Repo )",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT Url, Stars FROM Repo WHERE Stars = ( SELECT MAX(Stars) FROM Repo )",
"index": 281,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Summary text, -- example: ['Amount', 'Converts the query expression into text ', 'Execute the query expression ']\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore stars mean more people like this repository; most liked refers to max(Stars); the github address of repository refers to Url;\nWhat is the most liked repository? Indicate its github address and the amount of stars it has received.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['apiCall', 'give', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: [' Give', 'Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['API call.', 'Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['api call', 'html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlinearized sequenced of API calls refers to ApiCalls; 'https://github.com/wallerdev/htmlsharp.git' is url of repository\nIn the \"https://github.com/wallerdev/htmlsharp.git\", give all the linearized sequenced of API calls.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ApiCalls FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId INNER JOIN Method AS T3 ON T2.Id = T3.SolutionId WHERE T1.Url = 'https://github.com/wallerdev/htmlsharp.git'",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT T3.ApiCalls FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId INNER JOIN Method AS T3 ON T2.Id = T3.SolutionId WHERE T1.Url = 'https://github.com/wallerdev/htmlsharp.git'",
"index": 282,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['apiCall', 'give', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: [' Give', 'Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['API call.', 'Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['api call', 'html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlinearized sequenced of API calls refers to ApiCalls; 'https://github.com/wallerdev/htmlsharp.git' is url of repository\nIn the \"https://github.com/wallerdev/htmlsharp.git\", give all the linearized sequenced of API calls.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['inside', 'Inside', 'insId', 'most', 'more', 'how']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore watchers mean that this repository is more popular; most popular repository refers to max(Watchers);\nHow many solution paths are there inside the 2nd most popular repository?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T2.Path) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Watchers = ( SELECT Watchers FROM Repo ORDER BY Watchers DESC LIMIT 1, 1 )",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.Path) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Watchers = ( SELECT Watchers FROM Repo ORDER BY Watchers DESC LIMIT 1, 1 )",
"index": 283,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['inside', 'Inside', 'insId', 'most', 'more', 'how']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore watchers mean that this repository is more popular; most popular repository refers to max(Watchers);\nHow many solution paths are there inside the 2nd most popular repository?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['API call.', 'Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['apiCall', 'What', 'what', 'sln', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlinearized sequenced of API calls refers to ApiCalls;\nWhat is the linearized sequenced of API calls of the method whose solution path is \"mauriciodeamorim_tdd.encontro2\\Tdd.Encontro2.sln\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ApiCalls FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'mauriciodeamorim_tdd.encontro2Tdd.Encontro2.sln'",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT T2.ApiCalls FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'mauriciodeamorim_tdd.encontro2Tdd.Encontro2.sln'",
"index": 284,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['API call.', 'Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['apiCall', 'What', 'what', 'sln', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlinearized sequenced of API calls refers to ApiCalls;\nWhat is the linearized sequenced of API calls of the method whose solution path is \"mauriciodeamorim_tdd.encontro2\\Tdd.Encontro2.sln\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Type text, -- example: ['System.String', 'System.Int32']\n Name text, -- example: ['data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe comment for this method is not XML refers to CommentsXML = 0; the comments for this method is XML refers to CommentsXML = 1\nAre the comments for the method \"HtmlSharp.HtmlParser.Feed\" in XML format?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CASE WHEN CommentIsXml = 0 THEN 'No' WHEN CommentIsXml = 1 THEN 'Yes' END isXMLFormat FROM Method WHERE Name = 'HtmlSharp.HtmlParser.Feed'",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT CASE WHEN CommentIsXml = 0 THEN 'No' WHEN CommentIsXml = 1 THEN 'Yes' END isXMLFormat FROM Method WHERE Name = 'HtmlSharp.HtmlParser.Feed'",
"index": 285,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Type text, -- example: ['System.String', 'System.Int32']\n Name text, -- example: ['data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe comment for this method is not XML refers to CommentsXML = 0; the comments for this method is XML refers to CommentsXML = 1\nAre the comments for the method \"HtmlSharp.HtmlParser.Feed\" in XML format?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['Write a command to the log', 'Converts the query expression into text ', 'Execute the query expression ']\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Type text, -- example: ['System.String', 'System.Int32']\n Name text, -- example: ['which', 'Which', 'has', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich method has the summary \"Write a command to the log\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Name FROM Method WHERE Summary = 'Write a command to the log'",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT Name FROM Method WHERE Summary = 'Write a command to the log'",
"index": 286,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['Write a command to the log', 'Converts the query expression into text ', 'Execute the query expression ']\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Type text, -- example: ['System.String', 'System.Int32']\n Name text, -- example: ['which', 'Which', 'has', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich method has the summary \"Write a command to the log\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n CommentIsXml integer, -- example: [0, 1]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Type text, -- example: ['System.String', 'System.Int32']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore stars mean more people like this repository; most people like refers to max(Stars);\nHow many solutions contain files found within the repository most people like?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars = ( SELECT MAX(Stars) FROM Repo )",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars = ( SELECT MAX(Stars) FROM Repo )",
"index": 287,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n CommentIsXml integer, -- example: [0, 1]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Type text, -- example: ['System.String', 'System.Int32']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore stars mean more people like this repository; most people like refers to max(Stars);\nHow many solutions contain files found within the repository most people like?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Type text, -- example: ['System.String', 'System.Int32']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore stars mean more people like this repository; most people like refers to max(Stars);\nPlease list the path of the solution that contains files found within the repository most people like.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.Path FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars = ( SELECT MAX(Stars) FROM Repo )",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT DISTINCT T2.Path FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars = ( SELECT MAX(Stars) FROM Repo )",
"index": 288,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Type text, -- example: ['System.String', 'System.Int32']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore stars mean more people like this repository; most people like refers to max(Stars);\nPlease list the path of the solution that contains files found within the repository most people like.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Type text, -- example: ['System.String', 'System.Int32']\n Name text, -- example: ['Within', 'within', 'which', 'Which', 'more', 'data']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore watchers mean that this repository is more popular;\nWhich solution contains files within a more popular repository, the solution ID18 or solution ID19?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CASE WHEN SUM(CASE WHEN T2.Id = 18 THEN T1.Watchers ELSE 0 END) > SUM(CASE WHEN T2.Id = 19 THEN T1.Watchers ELSE 0 END) THEN 'SolutionID18' WHEN SUM(CASE WHEN T2.Id = 18 THEN T1.Watchers ELSE 0 END) < SUM(CASE WHEN T2.Id = 19 THEN T1.Watchers ELSE 0 END) THEN 'SolutionID19' END isMorePopular FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT CASE WHEN SUM(CASE WHEN T2.Id = 18 THEN T1.Watchers ELSE 0 END) > SUM(CASE WHEN T2.Id = 19 THEN T1.Watchers ELSE 0 END) THEN 'SolutionID18' WHEN SUM(CASE WHEN T2.Id = 18 THEN T1.Watchers ELSE 0 END) < SUM(CASE WHEN T2.Id = 19 THEN T1.Watchers ELSE 0 END) THEN 'SolutionID19' END isMorePopular FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId",
"index": 289,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Type text, -- example: ['System.String', 'System.Int32']\n Name text, -- example: ['Within', 'within', 'which', 'Which', 'more', 'data']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore watchers mean that this repository is more popular;\nWhich solution contains files within a more popular repository, the solution ID18 or solution ID19?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/maxild/playground.git', 'https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n CommentIsXml integer, -- example: [0, 1]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Type text, -- example: ['System.String', 'System.Int32']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease list all the paths of the solutions containing files within the repository whose url is \"https://github.com/maxild/playground.git\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Path FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Url = 'https://github.com/maxild/playground.git'",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT T2.Path FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Url = 'https://github.com/maxild/playground.git'",
"index": 290,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/maxild/playground.git', 'https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n CommentIsXml integer, -- example: [0, 1]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Type text, -- example: ['System.String', 'System.Int32']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease list all the paths of the solutions containing files within the repository whose url is \"https://github.com/maxild/playground.git\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Stars integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 200 likes refers to Stars > 200; ProcessedTime<636439500080712000;\nAmong the repositories with over 200 likes, how many of them have files contained by solutions with a processed time of under 636439500080712000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.ProcessedTime < 636439500080712000 AND T1.Stars > 200",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.ProcessedTime < 636439500080712000 AND T1.Stars > 200",
"index": 291,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Stars integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 200 likes refers to Stars > 200; ProcessedTime<636439500080712000;\nAmong the repositories with over 200 likes, how many of them have files contained by solutions with a processed time of under 636439500080712000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['Within', 'within', 'people', 'forks', 'fork', 'more']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Forks integer, -- example: [2, 3]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore forks refers to more people follow this repository;\nPlease list the IDs of the solutions that contain files within the top 3 followed repositories.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Id FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId ORDER BY T1.Forks DESC LIMIT 3",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT T2.Id FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId ORDER BY T1.Forks DESC LIMIT 3",
"index": 292,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['Within', 'within', 'people', 'forks', 'fork', 'more']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Forks integer, -- example: [2, 3]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore forks refers to more people follow this repository;\nPlease list the IDs of the solutions that contain files within the top 3 followed repositories.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Type text, -- example: ['System.String', 'System.Int32']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfollowers refers to Forks; percentage = divide(SUBTRACT(Forks(Solution.ID = 18), Forks(Solution.ID = 19)), Forks(Solution.ID = 19))*100%\nHow many more followers in percentage are there for the repository used by solution ID 18 than solution ID19?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Id = 18 THEN T1.Forks ELSE 0 END) - SUM(CASE WHEN T2.Id = 19 THEN T1.Forks ELSE 0 END)) AS REAL) * 100 / SUM(CASE WHEN T2.Id = 19 THEN T1.Forks ELSE 0 END) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT CAST((SUM(CASE WHEN T2.Id = 18 THEN T1.Forks ELSE 0 END) - SUM(CASE WHEN T2.Id = 19 THEN T1.Forks ELSE 0 END)) AS REAL) * 100 / SUM(CASE WHEN T2.Id = 19 THEN T1.Forks ELSE 0 END) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId",
"index": 293,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Type text, -- example: ['System.String', 'System.Int32']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfollowers refers to Forks; percentage = divide(SUBTRACT(Forks(Solution.ID = 18), Forks(Solution.ID = 19)), Forks(Solution.ID = 19))*100%\nHow many more followers in percentage are there for the repository used by solution ID 18 than solution ID19?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Forks integer, -- example: [2, 3]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nShow the full Comment of the method \"DE2_UE_Fahrradkurier.de2_uebung_fahrradkurierDataSet1TableAdapters.TableAdapterManager.UpdateInsertedRows\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT FullComment FROM Method WHERE Name = 'DE2_UE_Fahrradkurier.de2_uebung_fahrradkurierDataSet1TableAdapters.TableAdapterManager.UpdateInsertedRows'",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT FullComment FROM Method WHERE Name = 'DE2_UE_Fahrradkurier.de2_uebung_fahrradkurierDataSet1TableAdapters.TableAdapterManager.UpdateInsertedRows'",
"index": 294,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Forks integer, -- example: [2, 3]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nShow the full Comment of the method \"DE2_UE_Fahrradkurier.de2_uebung_fahrradkurierDataSet1TableAdapters.TableAdapterManager.UpdateInsertedRows\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Type text, -- example: ['System.String', 'System.Int32']\n Name text, -- example: ['data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the summary of the method \"Castle.MonoRail.Framework.Test.StubViewComponentContext.RenderSection\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Summary FROM Method WHERE Name = 'Castle.MonoRail.Framework.Test.StubViewComponentContext.RenderSection'",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT DISTINCT Summary FROM Method WHERE Name = 'Castle.MonoRail.Framework.Test.StubViewComponentContext.RenderSection'",
"index": 295,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Url text, -- example: ['https://github.com/wallerdev/htmlsharp.g', 'https://github.com/unclebob/nslim.git']\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Type text, -- example: ['System.String', 'System.Int32']\n Name text, -- example: ['data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n Summary text, -- example: ['Converts the query expression into text ', 'Execute the query expression ']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the summary of the method \"Castle.MonoRail.Framework.Test.StubViewComponentContext.RenderSection\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['give', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGive the tokenized name for the method \"Supay.Irc.Messages.KnockMessage.GetTokens\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT NameTokenized FROM Method WHERE Name = 'Supay.Irc.Messages.KnockMessage.GetTokens'",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT NameTokenized FROM Method WHERE Name = 'Supay.Irc.Messages.KnockMessage.GetTokens'",
"index": 296,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['give', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGive the tokenized name for the method \"Supay.Irc.Messages.KnockMessage.GetTokens\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['What', 'what', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsolution path refers to Path; method refers to Name; Name = 'IQ.Data.DbQueryProvider.CanBeEvaluatedLocally'\nWhat is the solution path for the method \"IQ.Data.DbQueryProvider.CanBeEvaluatedLocally\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Path FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Name = 'IQ.Data.DbQueryProvider.CanBeEvaluatedLocally'",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT T1.Path FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Name = 'IQ.Data.DbQueryProvider.CanBeEvaluatedLocally'",
"index": 297,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n CommentIsXml integer, -- example: [0, 1]\n SampledAt integer, -- example: [636430963695654788, 636430963695709898]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['What', 'what', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsolution path refers to Path; method refers to Name; Name = 'IQ.Data.DbQueryProvider.CanBeEvaluatedLocally'\nWhat is the solution path for the method \"IQ.Data.DbQueryProvider.CanBeEvaluatedLocally\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['interp parser expr', 'parser expr', 'html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Name text, -- example: ['ProcessedTime', 'nameToken', 'interp', 'which', 'Which', 'What']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntokenized name refers to NameTokenized; NameTokenized = 'interp parser expr'; processed time for its solution refers to ProcessedTime;\nFor the method which got the tokenized name as 'interp parser expr', what is the processed time for its solution?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ProcessedTime FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.NameTokenized = 'interp parser expr'",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT T1.ProcessedTime FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.NameTokenized = 'interp parser expr'",
"index": 298,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n ApiCalls text, -- example: ['System.String.IsNullOrEmpty HtmlSharp.Ht', 'HtmlSharp.HtmlParser.ScanName System.Col']\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n NameTokenized text, -- example: ['interp parser expr', 'parser expr', 'html parser feed', 'html parser parse doctype element']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n Path text, -- example: ['wallerdev_htmlsharp\\\\HtmlSharp.sln', 'maravillas_linq-to-delicious\\\\tasty.sln']\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n WasCompiled integer, -- example: [1, 0]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Stars integer, -- example: [14, 6]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n ProcessedTime integer, -- example: [636430963247108053, 636472436323838240]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Name text, -- example: ['ProcessedTime', 'nameToken', 'interp', 'which', 'Which', 'What']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntokenized name refers to NameTokenized; NameTokenized = 'interp parser expr'; processed time for its solution refers to ProcessedTime;\nFor the method which got the tokenized name as 'interp parser expr', what is the processed time for its solution?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Name text, -- example: ['repoID', 'repoId', 'What', 'what', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['SCore.Poisson.ngtIndex', 'HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n CommentIsXml integer, -- example: [0, 1]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepository number refers to RepoId; method refers to Name; Name = ‘SCore.Poisson.ngtIndex’\nWhat is the repository number for the solution of method \"SCore.Poisson.ngtIndex\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.RepoId FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Name = 'SCore.Poisson.ngtIndex'",
"style": "rule"
} | {
"db_id": "codebase_comments.sqlite",
"gt_sql": "SELECT T1.RepoId FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Name = 'SCore.Poisson.ngtIndex'",
"index": 299,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE MethodParameter (\n Id integer, -- example: [1, 2]\n MethodId text, -- example: ['1', '2']\n Name text, -- example: ['repoID', 'repoId', 'What', 'what', 'data', 'i']\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Solution (\n Id integer, -- example: [1, 2]\n RepoId integer, -- Repository Id, example: [1, 3]\n ProcessedTime integer, -- example: [636430963695642191, 636430963721734366]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Repo (\n Id integer, -- example: [1, 2]\n Forks integer, -- example: [2, 3]\n Watchers integer, -- example: [14, 6]\n PRIMARY KEY (Id)\n);\n\nCREATE TABLE Method (\n Id integer, -- example: [1, 2]\n Name text, -- example: ['SCore.Poisson.ngtIndex', 'HtmlSharp.HtmlParser.Feed', 'HtmlSharp.HtmlParser.ParseDoctypeElement']\n FullComment text, -- example: ['Feeds data into the parser', ' interneral -- scan past <!ELEMENT decla']\n CommentIsXml integer, -- example: [0, 1]\n SolutionId integer, -- example: [1, 2]\n Lang text, -- Language, example: ['en', 'fr']\n PRIMARY KEY (Id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrepository number refers to RepoId; method refers to Name; Name = ‘SCore.Poisson.ngtIndex’\nWhat is the repository number for the solution of method \"SCore.Poisson.ngtIndex\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\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.