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 `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-685681052912873473', 'tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['TW', 'AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntw-685681052912873473' is the TweetID\nWhich state was the tweet `tw-685681052912873473` from? Give the state 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 T2.StateCode FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.TweetID = 'tw-685681052912873473'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT T2.StateCode FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.TweetID = 'tw-685681052912873473'",
"index": 400,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-685681052912873473', 'tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['TW', 'AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntw-685681052912873473' is the TweetID\nWhich state was the tweet `tw-685681052912873473` from? Give the state 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 twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Florida', 'Elbasan', 'Tirane']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Florida\" is the State; male user refers to Gender = 'Male'; percentage = Divide (Count(UserID where Gender = 'Male'), Count (UserID)) * 100\nWhat is the percentage of male Twitter users from Florida?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(CASE WHEN T3.Gender = 'Male' THEN 1.0 ELSE 0 END) / COUNT(T1.TweetID) AS percentage FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.State = 'Florida'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T3.Gender = 'Male' THEN 1.0 ELSE 0 END) / COUNT(T1.TweetID) AS percentage FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.State = 'Florida'",
"index": 401,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Florida', 'Elbasan', 'Tirane']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Florida\" is the State; male user refers to Gender = 'Male'; percentage = Divide (Count(UserID where Gender = 'Male'), Count (UserID)) * 100\nWhat is the percentage of male Twitter users from Florida?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Hour` integer, -- example: [17, 18]\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Klout integer, -- example: [35, 53]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Happy New Year to all those AWS instances of ours!\" is the text; seen unique users refers to Reach\nHow many unique users have seen tweet with text `Happy New Year to all those AWS instances of ours!`?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Reach FROM twitter WHERE text = 'Happy New Year to all those AWS instances of ours!'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT Reach FROM twitter WHERE text = 'Happy New Year to all those AWS instances of ours!'",
"index": 402,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Hour` integer, -- example: [17, 18]\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Klout integer, -- example: [35, 53]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Happy New Year to all those AWS instances of ours!\" is the text; seen unique users refers to Reach\nHow many unique users have seen tweet with text `Happy New Year to all those AWS instances of ours!`?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Wednesday', 'Thursday', 'Friday']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Wednesday\" is the Weekday\nHow many tweets have been posted on Wednesday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(TweetID) FROM twitter WHERE Weekday = 'Wednesday'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT COUNT(TweetID) FROM twitter WHERE Weekday = 'Wednesday'",
"index": 403,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Wednesday', 'Thursday', 'Friday']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Wednesday\" is the Weekday\nHow many tweets have been posted on Wednesday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n State text, -- example: ['Elbasan', 'Tirane']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"en\" is the language and refers to Lang = 'en'; most tweet in 'en' refers to Max(Count(text where Lang = 'en'))\nWhat gender of users posted the most tweets in `en`?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T.Gender FROM ( SELECT T2.Gender, COUNT( text) AS num FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Lang = 'en' GROUP BY T2.Gender ) T ORDER BY T.num DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT T.Gender FROM ( SELECT T2.Gender, COUNT( text) AS num FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Lang = 'en' GROUP BY T2.Gender ) T ORDER BY T.num DESC LIMIT 1",
"index": 404,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n State text, -- example: ['Elbasan', 'Tirane']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"en\" is the language and refers to Lang = 'en'; most tweet in 'en' refers to Max(Count(text where Lang = 'en'))\nWhat gender of users posted the most tweets in `en`?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n `Hour` integer, -- example: [17, 18]\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nretweet more than 30 times refers to RetweetCount > 30\nWhat gender of users retweet more than 30 times?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.RetweetCount > 30",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT DISTINCT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.RetweetCount > 30",
"index": 405,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n `Hour` integer, -- example: [17, 18]\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nretweet more than 30 times refers to RetweetCount > 30\nWhat gender of users retweet more than 30 times?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Likes integer, -- example: [0, 131]\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n StateCode text, -- example: ['AL', 'DZ']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry collected the most likes refers to Country where Max(Sum(Likes))\nWhich country's tweets collected the most likes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T.Country FROM ( SELECT T2.Country, SUM(T1.Likes) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID GROUP BY T2.Country ) T ORDER BY T.num DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT T.Country FROM ( SELECT T2.Country, SUM(T1.Likes) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID GROUP BY T2.Country ) T ORDER BY T.num DESC LIMIT 1",
"index": 406,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Likes integer, -- example: [0, 131]\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n StateCode text, -- example: ['AL', 'DZ']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry collected the most likes refers to Country where Max(Sum(Likes))\nWhich country's tweets collected the most likes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682723090279841798', 'tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"tw-682723090279841798\" is the TweetID\nTweet with ID tw-682723090279841798 was posted 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 T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.TweetID = 'tw-682723090279841798'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.TweetID = 'tw-682723090279841798'",
"index": 407,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682723090279841798', 'tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"tw-682723090279841798\" is the TweetID\nTweet with ID tw-682723090279841798 was posted 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 twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Australia', 'Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Australia\" is the Country\nList down all the tweet text posted from Australia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.text FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Australia'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Australia'",
"index": 408,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Australia', 'Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Australia\" is the Country\nList down all the tweet text posted from Australia.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale user refers to Gender = 'Male'; average tweet in a week per user refers to Divide ( Divide(Count(TweetID), Count (UserID)), Divide(31, 7))\nCalculate the average number of male users who posted tweets in a week.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T1.TweetID) / COUNT(DISTINCT T1.UserID) / 7 AS avg FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Day BETWEEN 1 AND 31",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.TweetID) / COUNT(DISTINCT T1.UserID) / 7 AS avg FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Day BETWEEN 1 AND 31",
"index": 409,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale user refers to Gender = 'Male'; average tweet in a week per user refers to Divide ( Divide(Count(TweetID), Count (UserID)), Divide(31, 7))\nCalculate the average number of male users who posted tweets in a week.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n Klout integer, -- example: [35, 53]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nklout of over 50 refers to Klout > 50\nHow many tweets have a klout of over 50?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 TweetID) FROM twitter WHERE Klout > 50",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE Klout > 50",
"index": 410,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n Klout integer, -- example: [35, 53]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nklout of over 50 refers to Klout > 50\nHow many tweets have a klout of over 50?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n `Hour` integer, -- example: [17, 18]\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot in English refers to Lang <> en'\nPlease list the texts of all the tweets that are not in English.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT text FROM twitter WHERE Lang != 'en'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT text FROM twitter WHERE Lang != 'en'",
"index": 411,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n `Hour` integer, -- example: [17, 18]\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot in English refers to Lang <> en'\nPlease list the texts of all the tweets that are not in English.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Monday', 'Thursday', 'Friday']\n `Hour` integer, -- example: [17, 18]\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['TRUE', 'FALSE']\n Reach integer, -- example: [44, 1810]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Monday\" is the Weekday; reshare refers to IsReshare = 'TRUE'\nAmong all the tweets posted on Mondays, how many of them are reshared?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 TweetID) FROM twitter WHERE Weekday = 'Monday' AND IsReshare = 'TRUE'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE Weekday = 'Monday' AND IsReshare = 'TRUE'",
"index": 412,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Monday', 'Thursday', 'Friday']\n `Hour` integer, -- example: [17, 18]\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['TRUE', 'FALSE']\n Reach integer, -- example: [44, 1810]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Monday\" is the Weekday; reshare refers to IsReshare = 'TRUE'\nAmong all the tweets posted on Mondays, how many of them are reshared?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Hour` integer, -- example: [17, 18]\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n Reach integer, -- example: [44, 1810]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most number of unique users seeing refers to Max(Reach)\nPlease list the texts of the top 3 tweets with the most number of unique users seeing the tweet.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT text FROM twitter ORDER BY Reach DESC LIMIT 3",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT text FROM twitter ORDER BY Reach DESC LIMIT 3",
"index": 413,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Hour` integer, -- example: [17, 18]\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n Reach integer, -- example: [44, 1810]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most number of unique users seeing refers to Max(Reach)\nPlease list the texts of the top 3 tweets with the most number of unique users seeing the tweet.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Monday', 'Thursday', 'Friday']\n `Day` integer, -- example: [31, 1]\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale user refers to Gender = 'Male; 'Monday' is the Weekday; total number of tweet refers to Count (TweetID)\nWhat is the total number of tweets sent by male users on Mondays?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Weekday = 'Monday'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Weekday = 'Monday'",
"index": 414,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Monday', 'Thursday', 'Friday']\n `Day` integer, -- example: [31, 1]\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale user refers to Gender = 'Male; 'Monday' is the Weekday; total number of tweet refers to Count (TweetID)\nWhat is the total number of tweets sent by male users on Mondays?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntweet got the most likes refers to Max(Likes)\nWhat is the gender of the user who has posted the tweet that got the most likes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID ORDER BY T1.Likes DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID ORDER BY T1.Likes DESC LIMIT 1",
"index": 415,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntweet got the most likes refers to Max(Likes)\nWhat is the gender of the user who has posted the tweet that got the most likes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Lang text, -- language, example: ['fr', 'en', '_u']\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n StateCode text, -- example: ['FR', 'AL', 'DZ']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"French\" is the language and refers to Lang = 'fr'; male user refers to Gender = 'Male'\nPlease list the texts of all the tweets in French posted by male users.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.text FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Lang = 'fr'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT T1.text FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Lang = 'fr'",
"index": 416,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Lang text, -- language, example: ['fr', 'en', '_u']\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n StateCode text, -- example: ['FR', 'AL', 'DZ']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"French\" is the language and refers to Lang = 'fr'; male user refers to Gender = 'Male'\nPlease list the texts of all the tweets in French posted by male users.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Australia', 'Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntweet with positive sentiment refers to Sentiment > 0; male user refers to Gender = 'Male'; 'Australia' is the Country\nAmong all the tweets with a positive sentiment, how many of them were posted by male users in Australia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.Country = 'Australia' AND T3.Gender = 'Male' AND T1.Sentiment > 0",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.Country = 'Australia' AND T3.Gender = 'Male' AND T1.Sentiment > 0",
"index": 417,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Australia', 'Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntweet with positive sentiment refers to Sentiment > 0; male user refers to Gender = 'Male'; 'Australia' is the Country\nAmong all the tweets with a positive sentiment, how many of them were posted by male users in Australia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n RetweetCount integer, -- example: [0, 5]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntweet with most number of retweet post refers to Max(RetweetCount)\nFrom which city was the tweet with the most number of retweets posted?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.City FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID ORDER BY T1.RetweetCount DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID ORDER BY T1.RetweetCount DESC LIMIT 1",
"index": 418,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n RetweetCount integer, -- example: [0, 5]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntweet with most number of retweet post refers to Max(RetweetCount)\nFrom which city was the tweet with the most number of retweets posted?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n City text, -- example: ['Chiang Mai', 'Bangkok', 'Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Bangkok\" and \"Chiang Mai\" are both City\nFrom which city were more tweets posted, Bangkok or Chiang Mai?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(CASE WHEN T2.City = 'Bangkok' THEN 1 ELSE 0 END) AS bNum , SUM(CASE WHEN T2.City = 'Chiang Mai' THEN 1 ELSE 0 END) AS cNum FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City IN ('Bangkok', 'Chiang Mai')",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.City = 'Bangkok' THEN 1 ELSE 0 END) AS bNum , SUM(CASE WHEN T2.City = 'Chiang Mai' THEN 1 ELSE 0 END) AS cNum FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City IN ('Bangkok', 'Chiang Mai')",
"index": 419,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n City text, -- example: ['Chiang Mai', 'Bangkok', 'Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Bangkok\" and \"Chiang Mai\" are both City\nFrom which city were more tweets posted, Bangkok or Chiang Mai?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Argentina', 'Albania', 'Algeria']\n State text, -- example: ['Santa Fe', 'Elbasan', 'Tirane']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Sante Fe\" is the State; \"Argentina\" is the Country; posted on 31st refers to Day = 31\nAmong the tweets posted from Santa Fe state in Argentina, how many of them were posted on 31st?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.Day = 31 AND T2.State = 'Santa' AND T2.Country = 'Argentina'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.Day = 31 AND T2.State = 'Santa' AND T2.Country = 'Argentina'",
"index": 420,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Argentina', 'Albania', 'Algeria']\n State text, -- example: ['Santa Fe', 'Elbasan', 'Tirane']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Sante Fe\" is the State; \"Argentina\" is the Country; posted on 31st refers to Day = 31\nAmong the tweets posted from Santa Fe state in Argentina, how many of them were posted on 31st?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Canada', 'Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n `Hour` integer, -- example: [17, 18]\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Canada\" is the Country; city with most number of tweets refers to City where Max(Count(TweetID))\nPlease list the top 3 cities with the most number of tweets posted 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 T.City FROM ( SELECT T2.City, COUNT(T1.TweetID) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Canada' GROUP BY T2.City ) T ORDER BY T.num DESC LIMIT 3",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT T.City FROM ( SELECT T2.City, COUNT(T1.TweetID) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Canada' GROUP BY T2.City ) T ORDER BY T.num DESC LIMIT 3",
"index": 421,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Canada', 'Albania', 'Algeria']\n State text, -- example: ['Elbasan', 'Tirane']\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Unknown', 'Male']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Thursday', 'Friday']\n `Hour` integer, -- example: [17, 18]\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Reach integer, -- example: [44, 1810]\n RetweetCount integer, -- example: [0, 5]\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Canada\" is the Country; city with most number of tweets refers to City where Max(Count(TweetID))\nPlease list the top 3 cities with the most number of tweets posted 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 location (\n LocationID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Sentiment real, -- example: [0.0, 2.0]\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nneutral sentiment refers to Sentiment = 0\nPlease list all the cities from where tweets with neutral sentiments were posted.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.City FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE Sentiment = 0",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT DISTINCT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE Sentiment = 0",
"index": 422,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n StateCode text, -- example: ['AL', 'DZ']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Sentiment real, -- example: [0.0, 2.0]\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nneutral sentiment refers to Sentiment = 0\nPlease list all the cities from where tweets with neutral sentiments were posted.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Monday', 'Thursday', 'Friday']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale user refers to Gender = 'Male'; 'Monday' is the Weekday; average number of likes = Divide (Sum(Likes), Count(TweetID))\nWhat is the average number of likes for a tweet posted by a male user on Mondays?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Likes) / COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Weekday = 'Monday'",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT SUM(T1.Likes) / COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Weekday = 'Monday'",
"index": 423,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n Country text, -- example: ['Albania', 'Algeria']\n City text, -- example: ['Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Weekday text, -- example: ['Monday', 'Thursday', 'Friday']\n `Day` integer, -- example: [31, 1]\n Lang text, -- language, example: ['en', '_u']\n Likes integer, -- example: [0, 131]\n Klout integer, -- example: [35, 53]\n Sentiment real, -- example: [0.0, 2.0]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n Gender text, -- example: ['Male', 'Unknown']\n PRIMARY KEY (UserID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale user refers to Gender = 'Male'; 'Monday' is the Weekday; average number of likes = Divide (Sum(Likes), Count(TweetID))\nWhat is the average number of likes for a tweet posted by a male user on Mondays?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Likes integer, -- example: [0, 131]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n State text, -- example: ['Chiang Mai', 'Bangkok', 'Elbasan', 'Tirane']\n City text, -- example: ['Chiang Mai', 'Bangkok', 'Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Bangkok\" and \"Chiang Mai\" are both City; average number of like = Divide (Sum(Likes), Count(TweetID))\nTweets posted from which city has a higher number of average likes, Bangkok or Chiang Mai?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(CASE WHEN T2.City = 'Bangkok' THEN Likes ELSE NULL END) / COUNT(CASE WHEN T2.City = 'Bangkok' THEN 1 ELSE 0 END) AS bNum , SUM(CASE WHEN City = 'Chiang Mai' THEN Likes ELSE NULL END) / COUNT(CASE WHEN City = 'Chiang Mai' THEN TweetID ELSE NULL END) AS cNum FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City IN ('Bangkok', 'Chiang Mai')",
"style": "rule"
} | {
"db_id": "social_media.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.City = 'Bangkok' THEN Likes ELSE NULL END) / COUNT(CASE WHEN T2.City = 'Bangkok' THEN 1 ELSE 0 END) AS bNum , SUM(CASE WHEN City = 'Chiang Mai' THEN Likes ELSE NULL END) / COUNT(CASE WHEN City = 'Chiang Mai' THEN TweetID ELSE NULL END) AS cNum FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City IN ('Bangkok', 'Chiang Mai')",
"index": 424,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `user` (\n UserID text, -- example: ['\\x1anknow531394', 'tw-10000632']\n PRIMARY KEY (UserID)\n);\n\nCREATE TABLE twitter (\n TweetID text, -- example: ['tw-682712873332805633', 'tw-682713045357998080']\n Lang text, -- language, example: ['en', '_u']\n IsReshare text, -- example: ['FALSE', 'TRUE']\n Likes integer, -- example: [0, 131]\n text text, -- example: ['We are hiring: Senior Software Engineer ', 'RT @CodeMineStatus: This is true Amazon ']\n LocationID integer, -- example: [3751, 3989]\n UserID text, -- example: ['tw-40932430', 'tw-3179389829']\n PRIMARY KEY (TweetID),\n CONSTRAINT fk_twitter_locationid FOREIGN KEY (LocationID) REFERENCES location (LocationID),\n CONSTRAINT fk_twitter_userid FOREIGN KEY (UserID) REFERENCES `user` (UserID)\n);\n\nCREATE TABLE location (\n LocationID integer, -- example: [1, 2]\n State text, -- example: ['Chiang Mai', 'Bangkok', 'Elbasan', 'Tirane']\n City text, -- example: ['Chiang Mai', 'Bangkok', 'Elbasan', 'Tirana']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Bangkok\" and \"Chiang Mai\" are both City; average number of like = Divide (Sum(Likes), Count(TweetID))\nTweets posted from which city has a higher number of average likes, Bangkok or Chiang Mai?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Intro to BlockChain', 'Computer Network', 'Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiff refers to difficulty; diff is higher means the course is more difficult;\nWhich course is more difficult, Intro to BlockChain or Computer Network?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 course WHERE name = 'Intro to BlockChain' OR name = 'Computer Network' ORDER BY diff DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT name FROM course WHERE name = 'Intro to BlockChain' OR name = 'Computer Network' ORDER BY diff DESC LIMIT 1",
"index": 425,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Intro to BlockChain', 'Computer Network', 'Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiff refers to difficulty; diff is higher means the course is more difficult;\nWhich course is more difficult, Intro to BlockChain or Computer Network?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlower credit means less important;\nPlease list the names of the courses that are less important than Machine Learning Theory.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 course WHERE credit < ( SELECT credit FROM course WHERE name = 'Machine Learning Theory' )",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT name FROM course WHERE credit < ( SELECT credit FROM course WHERE name = 'Machine Learning Theory' )",
"index": 426,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlower credit means less important;\nPlease list the names of the courses that are less important than Machine Learning Theory.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Faina', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Mallinar', 'Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; full name refers to f_name and l_name;\nWhich professor advised Faina Mallinar to become a research assistant? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Faina' AND T3.l_name = 'Mallinar'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Faina' AND T3.l_name = 'Mallinar'",
"index": 427,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Faina', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Mallinar', 'Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; full name refers to f_name and l_name;\nWhich professor advised Faina Mallinar to become a research assistant? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Sauveur', 'Nathaniel', 'Zhihua']\n last_name text, -- example: ['Skyme', 'Pigford', 'Zhou']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA;\nHow many research assistants does Sauveur Skyme 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(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Sauveur' AND T2.last_name = 'Skyme'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Sauveur' AND T2.last_name = 'Skyme'",
"index": 428,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Sauveur', 'Nathaniel', 'Zhihua']\n last_name text, -- example: ['Skyme', 'Pigford', 'Zhou']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA;\nHow many research assistants does Sauveur Skyme 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 registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Laughton', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Antonio', 'Pryor', 'Dine-Hart']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n PRIMARY KEY (prof_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 the names of the courses taken by Laughton Antonio.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.f_name = 'Laughton' AND T1.l_name = 'Antonio'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.f_name = 'Laughton' AND T1.l_name = 'Antonio'",
"index": 429,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Laughton', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Antonio', 'Pryor', 'Dine-Hart']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n PRIMARY KEY (prof_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 the names of the courses taken by Laughton Antonio.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUG is an abbreviated name of undergraduate student in which type = 'UG';\nAmong the students who took the course Machine Learning Theory, how many of them are undergraduates?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Machine Learning Theory' AND T1.type = 'UG'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Machine Learning Theory' AND T1.type = 'UG'",
"index": 430,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUG is an abbreviated name of undergraduate student in which type = 'UG';\nAmong the students who took the course Machine Learning Theory, how many of them are undergraduates?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Willie', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Rechert', 'Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; prof_id refers to professor’s ID; full name refers to f_name and l_name;\nWhich professor advised Willie Rechert to work as a research assistant? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Willie' AND T3.l_name = 'Rechert'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Willie' AND T3.l_name = 'Rechert'",
"index": 431,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Willie', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Rechert', 'Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; prof_id refers to professor’s ID; full name refers to f_name and l_name;\nWhich professor advised Willie Rechert to work as a research assistant? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Ogdon', 'Nathaniel', 'Zhihua']\n last_name text, -- example: ['Zywicki', 'Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; prof_id refers to professor’s ID; GPA is an abbreviated name of Grade Point Average where average = AVG(gpa);\nWhat is the average gpa of Ogdon Zywicki's research assistants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.gpa) / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T1.student_id = T3.student_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT SUM(T3.gpa) / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T1.student_id = T3.student_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki'",
"index": 432,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Ogdon', 'Nathaniel', 'Zhihua']\n last_name text, -- example: ['Zywicki', 'Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; prof_id refers to professor’s ID; GPA is an abbreviated name of Grade Point Average where average = AVG(gpa);\nWhat is the average gpa of Ogdon Zywicki's research assistants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsat refers to student's satisfaction degree with the course;\nWhat is the average satisfying degree of the course Machine Learning Theory?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.sat) AS REAL) / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = 'Machine Learning Theory'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT CAST(SUM(T1.sat) AS REAL) / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = 'Machine Learning Theory'",
"index": 433,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsat refers to student's satisfaction degree with the course;\nWhat is the average satisfying degree of the course Machine Learning Theory?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n last_name text, -- example: ['Pigford', 'Zhou']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGPA is an abbreviated name of Grade Point Average where highest GPA = MAX(gpa); full name refers to f_name and l_name;\nWhich student has the highest gpa? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student )",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student )",
"index": 434,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n last_name text, -- example: ['Pigford', 'Zhou']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGPA is an abbreviated name of Grade Point Average where highest GPA = MAX(gpa); full name refers to f_name and l_name;\nWhich student has the highest gpa? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiff refers to difficulty; diff is higher means the course is more difficult in which easiest difficulty refers to diff = 1; 3-credit course refers to credit = '3'; get an \"A\" refers to grade = 'A' for the course;\nFor the 3-credit course with the easiest difficulty, how many students get an \"A\" in that course?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.grade = 'A' AND T2.credit = '3' AND T2.diff = 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.grade = 'A' AND T2.credit = '3' AND T2.diff = 1",
"index": 435,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiff refers to difficulty; diff is higher means the course is more difficult in which easiest difficulty refers to diff = 1; 3-credit course refers to credit = '3'; get an \"A\" refers to grade = 'A' for the course;\nFor the 3-credit course with the easiest difficulty, how many students get an \"A\" in that course?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Oliy', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Spratling', 'Pryor', 'Dine-Hart']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; full name refers to f_name and l_name;\nWhich professor is Oliy Spratling working with? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Oliy' AND T3.l_name = 'Spratling'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Oliy' AND T3.l_name = 'Spratling'",
"index": 436,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Oliy', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Spratling', 'Pryor', 'Dine-Hart']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; full name refers to f_name and l_name;\nWhich professor is Oliy Spratling working with? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Female', 'Male']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; professor with the lowest teaching ability refers to prof_id where teachability = '1';\nHow many research assistants does the female professor with the lowest teaching ability 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(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability = '1' AND T2.gender = 'Female'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability = '1' AND T2.gender = 'Female'",
"index": 437,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Female', 'Male']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; professor with the lowest teaching ability refers to prof_id where teachability = '1';\nHow many research assistants does the female professor with the lowest teaching ability 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 course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessor advising more than 2 students refers to COUNT(student_id) > 2; higher teachability refers to MAX(teachingability); full name refers to f_name and l_name;\nFor the professors who advise more than 2 students, which professor has a higher teaching ability? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, T2.teachingability FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id GROUP BY T1.prof_id HAVING COUNT(student_id) > 2 ) T ORDER BY T.teachingability DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, T2.teachingability FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id GROUP BY T1.prof_id HAVING COUNT(student_id) > 2 ) T ORDER BY T.teachingability DESC LIMIT 1",
"index": 438,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessor advising more than 2 students refers to COUNT(student_id) > 2; higher teachability refers to MAX(teachingability); full name refers to f_name and l_name;\nFor the professors who advise more than 2 students, which professor has a higher teaching ability? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Computer Network', 'Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Rik', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Unsworth', 'Pryor', 'Dine-Hart']\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['D', 'C', 'B', 'A']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAcademic grades awarded for participation in a course are A, B, C, D and F where Grade 'A' means excellent, Grade 'B' means good, Grade 'C' means fair, Grade 'D' means poorly pass, if grade is null or empty, it means that this student fails to pass this course in which grade = NULL;\nGive the grade score for Rik Unsworth in \"Computer Network\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 grade WHEN 'A' THEN 4 WHEN 'B' THEN 3 WHEN 'C' THEN 2 ELSE 1 END AS result FROM registration WHERE student_id IN ( SELECT student_id FROM student WHERE f_name = 'Rik' AND l_name = 'Unsworth' AND course_id IN ( SELECT course_id FROM course WHERE name = 'Computer Network' ) )",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT CASE grade WHEN 'A' THEN 4 WHEN 'B' THEN 3 WHEN 'C' THEN 2 ELSE 1 END AS result FROM registration WHERE student_id IN ( SELECT student_id FROM student WHERE f_name = 'Rik' AND l_name = 'Unsworth' AND course_id IN ( SELECT course_id FROM course WHERE name = 'Computer Network' ) )",
"index": 439,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Computer Network', 'Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Rik', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Unsworth', 'Pryor', 'Dine-Hart']\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['D', 'C', 'B', 'A']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAcademic grades awarded for participation in a course are A, B, C, D and F where Grade 'A' means excellent, Grade 'B' means good, Grade 'C' means fair, Grade 'D' means poorly pass, if grade is null or empty, it means that this student fails to pass this course in which grade = NULL;\nGive the grade score for Rik Unsworth in \"Computer Network\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['TPG', 'RPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Ogdon', 'Nathaniel', 'Zhihua']\n last_name text, -- example: ['Zywicki', 'Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; taught postgraduate student refers to type = 'TPG'; DIVIDE(COUNT(student_id where type = 'TPG' and first_name = 'Ogdon', last_name = 'Zywicki'), COUNT(first_name = 'Ogdon', last_name = 'Zywicki')) as percentage;\nWhat is the percentage of Professor Ogdon Zywicki's research assistants are taught postgraduate students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T3.type = 'TPG' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T1.student_id = T3.student_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T3.type = 'TPG' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T1.student_id = T3.student_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki'",
"index": 440,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['TPG', 'RPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Ogdon', 'Nathaniel', 'Zhihua']\n last_name text, -- example: ['Zywicki', 'Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; taught postgraduate student refers to type = 'TPG'; DIVIDE(COUNT(student_id where type = 'TPG' and first_name = 'Ogdon', last_name = 'Zywicki'), COUNT(first_name = 'Ogdon', last_name = 'Zywicki')) as percentage;\nWhat is the percentage of Professor Ogdon Zywicki's research assistants are taught postgraduate students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHigher credit means more important in which most important refers to MAX(credit); diff refers to difficulty; the most difficult course refers to MAX(diff);\nAmong the most important courses, what is the name of the most difficult course?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 course WHERE credit = ( SELECT MAX(credit) FROM course ) AND diff = ( SELECT MAX(diff) FROM course )",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT name FROM course WHERE credit = ( SELECT MAX(credit) FROM course ) AND diff = ( SELECT MAX(diff) FROM course )",
"index": 441,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHigher credit means more important in which most important refers to MAX(credit); diff refers to difficulty; the most difficult course refers to MAX(diff);\nAmong the most important courses, what is the name of the most difficult course?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbachelor's degree is an undergraduate degree in which type = 'UG'; the highest intelligence refers to MAX(intelligence);\nHow many students have the highest intelligence among those taking a bachelor's degree?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(student_id) FROM student WHERE type = 'UG' AND intelligence = ( SELECT MAX(intelligence) FROM student )",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(student_id) FROM student WHERE type = 'UG' AND intelligence = ( SELECT MAX(intelligence) FROM student )",
"index": 442,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbachelor's degree is an undergraduate degree in which type = 'UG'; the highest intelligence refers to MAX(intelligence);\nHow many students have the highest intelligence among those taking a bachelor's degree?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Female', 'Male']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most popular professors refers to prof_id where MAX(popularity); female refers to gender;\nAmong the most popular professors, how many are females?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(prof_id) FROM prof WHERE gender = 'Female' AND popularity = ( SELECT MAX(popularity) FROM prof )",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(prof_id) FROM prof WHERE gender = 'Female' AND popularity = ( SELECT MAX(popularity) FROM prof )",
"index": 443,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Female', 'Male']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most popular professors refers to prof_id where MAX(popularity); female refers to gender;\nAmong the most popular professors, how many are females?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Applied Deep Learning ', 'Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nA refers to an excellent grade in which grade = 'A' for the course;\nHow many students got an A in Applied Deep Learning?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.student_id) FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'A' AND T1.name = 'Applied Deep Learning '",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T2.student_id) FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'A' AND T1.name = 'Applied Deep Learning '",
"index": 444,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Applied Deep Learning ', 'Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nA refers to an excellent grade in which grade = 'A' for the course;\nHow many students got an A in Applied Deep Learning?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['free', 'med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n last_name text, -- example: ['Pigford', 'Zhou']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUnpaid Research Assistants undertake their work without payment in which salary = 'free';\nWhat are the GPAs of the unpaid Research Assistants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.gpa FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'free'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T2.gpa FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'free'",
"index": 445,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['free', 'med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n last_name text, -- example: ['Pigford', 'Zhou']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUnpaid Research Assistants undertake their work without payment in which salary = 'free';\nWhat are the GPAs of the unpaid Research Assistants?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiff refers to difficulty; the easiest courses refers to diff = 1; A refers to an excellent grade in which grade = 'A' for the course;\nAmong the easiest courses, what is the name of the course where most students got an A?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.name FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.grade = 'A' AND T2.diff = 1 GROUP BY T2.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T2.name FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.grade = 'A' AND T2.diff = 1 GROUP BY T2.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1",
"index": 446,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiff refers to difficulty; the easiest courses refers to diff = 1; A refers to an excellent grade in which grade = 'A' for the course;\nAmong the easiest courses, what is the name of the course where most students got an A?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Ogdon', 'Nathaniel', 'Zhihua']\n last_name text, -- example: ['Zywicki', 'Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOgdon Zywicki is a professor;\nHow many students does Ogdon Zywicki advise?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Ogdon' AND T2.last_name = 'Zywicki'",
"index": 447,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Ogdon', 'Nathaniel', 'Zhihua']\n last_name text, -- example: ['Zywicki', 'Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOgdon Zywicki is a professor;\nHow many students does Ogdon Zywicki advise?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbachelor's degree is an undergraduate degree in which type = 'UG'; A refers to an excellent grade in which grade = 'A';\nHow many students taking a bachelor's degree received an A in all of the courses that they took?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T2.grade = 'A' AND T1.type = 'UG'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T2.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T2.grade = 'A' AND T1.type = 'UG'",
"index": 448,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbachelor's degree is an undergraduate degree in which type = 'UG'; A refers to an excellent grade in which grade = 'A';\nHow many students taking a bachelor's degree received an A in all of the courses that they took?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n popularity integer, -- example: [3, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['high', 'med']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest research capability refers to capability = 5; high salary refers to salary = 'high'; prof_id refers to professor’s ID; GPA is an abbreviated name of Grade Point Average where average GPA refers to AVG(gpa);\nWhat is the average GPA of the students with the highest research capability and high salary? List the full names of the students.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T2.gpa), T2.f_name, T2.l_name FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'high' AND T1.capability = 5 GROUP BY T2.student_id",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT AVG(T2.gpa), T2.f_name, T2.l_name FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'high' AND T1.capability = 5 GROUP BY T2.student_id",
"index": 449,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n popularity integer, -- example: [3, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['high', 'med']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest research capability refers to capability = 5; high salary refers to salary = 'high'; prof_id refers to professor’s ID; GPA is an abbreviated name of Grade Point Average where average GPA refers to AVG(gpa);\nWhat is the average GPA of the students with the highest research capability and high salary? List the full names of the students.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIf grade is null or empty, it means that this student fails to pass the course;\nList the courses' IDs and students' IDs who failed to pass the course.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT course_id, student_id FROM registration WHERE grade IS NULL OR grade = ''",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT course_id, student_id FROM registration WHERE grade IS NULL OR grade = ''",
"index": 450,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIf grade is null or empty, it means that this student fails to pass the course;\nList the courses' IDs and students' IDs who failed to pass the course.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Female', 'Male']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n intelligence integer, -- example: [5, 2]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(prof_id where gender = 'Male'), COUNT(prof_id where gender = 'Female'));\nWhat is the male and female ratio among the professors?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 gender = 'Male' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN gender = 'Female' THEN 1 ELSE 0 END) FROM prof",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN gender = 'Male' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN gender = 'Female' THEN 1 ELSE 0 END) FROM prof",
"index": 451,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Female', 'Male']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n intelligence integer, -- example: [5, 2]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(prof_id where gender = 'Male'), COUNT(prof_id where gender = 'Female'));\nWhat is the male and female ratio among the professors?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiff refers to difficulty; the least difficult courses refer to MIN(diff);\nDescribe the names and credits of the least difficult courses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, credit FROM course WHERE diff = ( SELECT MIN(diff) FROM course )",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT name, credit FROM course WHERE diff = ( SELECT MIN(diff) FROM course )",
"index": 452,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiff refers to difficulty; the least difficult courses refer to MIN(diff);\nDescribe the names and credits of the least difficult courses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstudent's full names = f_name, l_name; most popular refers to MAX(popularity);\nDescribe the students' full names and GPAs under the supervision of the most popular professor.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.f_name, T3.l_name, T3.gpa FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id ORDER BY T1.popularity DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T3.f_name, T3.l_name, T3.gpa FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id ORDER BY T1.popularity DESC LIMIT 1",
"index": 453,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstudent's full names = f_name, l_name; most popular refers to MAX(popularity);\nDescribe the students' full names and GPAs under the supervision of the most popular professor.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['free', 'med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull names = f_name, l_name; research assistant refers to the student who serves for research where the abbreviation is RA; unpaid research assistant refers to salary = 'free';\nProvide the full names and emails of unpaid research assistants.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.f_name, T2.l_name, T2.email FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'free'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T2.f_name, T2.l_name, T2.email FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'free'",
"index": 454,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['free', 'med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull names = f_name, l_name; research assistant refers to the student who serves for research where the abbreviation is RA; unpaid research assistant refers to salary = 'free';\nProvide the full names and emails of unpaid research assistants.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Merwyn', 'Nathaniel', 'Zhihua']\n last_name text, -- example: ['Conkay', 'Pigford', 'Zhou']\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; full names = f_name, l_name;\nList the research assistants' full names, capabilities and GPAs who were under the supervision of Merwyn Conkay.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.f_name, T3.l_name, T2.capability, T3.gpa FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T1.first_name = 'Merwyn' AND T1.last_name = 'Conkay'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T3.f_name, T3.l_name, T2.capability, T3.gpa FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T1.first_name = 'Merwyn' AND T1.last_name = 'Conkay'",
"index": 455,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Merwyn', 'Nathaniel', 'Zhihua']\n last_name text, -- example: ['Conkay', 'Pigford', 'Zhou']\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch assistant refers to the student who serves for research where the abbreviation is RA; full names = f_name, l_name;\nList the research assistants' full names, capabilities and GPAs who were under the supervision of Merwyn Conkay.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifficulty refers to diff; most difficult course refers to MAX(diff); student's full names = f_name, l_name;\nAmong students registered for the most difficult course, list the students' full names who got grade A.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.grade = 'A' ORDER BY T3.diff DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.grade = 'A' ORDER BY T3.diff DESC LIMIT 1",
"index": 456,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifficulty refers to diff; most difficult course refers to MAX(diff); student's full names = f_name, l_name;\nAmong students registered for the most difficult course, list the students' full names who got grade A.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Olia', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Rabier', 'Pryor', 'Dine-Hart']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull names of the professors = first_name, last_name; graduated universities of the professors refers to graduate_from;\nDescribe the full names and graduated universities of the professors who advised Olia Rabier.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.first_name, T1.last_name, T1.graduate_from FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Olia' AND T3.l_name = 'Rabier'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name, T1.graduate_from FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Olia' AND T3.l_name = 'Rabier'",
"index": 457,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Olia', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Rabier', 'Pryor', 'Dine-Hart']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull names of the professors = first_name, last_name; graduated universities of the professors refers to graduate_from;\nDescribe the full names and graduated universities of the professors who advised Olia Rabier.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Advanced Database Systems', 'Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull the students = f_name, l_name; course refers to name; satisfaction refers to sat; highest satisfaction refers to MAX(sat);\nName the students of the Advanced Database Systems course with the highest satisfaction.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Advanced Database Systems' ORDER BY T2.sat DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Advanced Database Systems' ORDER BY T2.sat DESC LIMIT 1",
"index": 458,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Advanced Database Systems', 'Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull the students = f_name, l_name; course refers to name; satisfaction refers to sat; highest satisfaction refers to MAX(sat);\nName the students of the Advanced Database Systems course with the highest satisfaction.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUndergraduate students refers to type = 'UG'; GPA of 3.7 and above refers to gpa > 3.7;\nProvide the registered courses' names by undergraduate students with GPA of 3.7 and above.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.f_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.type = 'UG' AND T1.gpa > 3.7",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT DISTINCT T1.f_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.type = 'UG' AND T1.gpa > 3.7",
"index": 459,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUndergraduate students refers to type = 'UG'; GPA of 3.7 and above refers to gpa > 3.7;\nProvide the registered courses' names by undergraduate students with GPA of 3.7 and above.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the students = f_name, l_name;\nDescribe the names and capability of the students who were advised by professors from the University of 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 T3.f_name, T3.l_name, T2.capability FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T1.graduate_from = 'University of Washington'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T3.f_name, T3.l_name, T2.capability FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T1.graduate_from = 'University of Washington'",
"index": 460,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the students = f_name, l_name;\nDescribe the names and capability of the students who were advised by professors from the University of 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 student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifficulty of a course refers to diff; most difficult course refers to MAX(diff);\nWhat is the name of the most difficult course?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 course WHERE diff = ( SELECT MAX(diff) FROM course )",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT name FROM course WHERE diff = ( SELECT MAX(diff) FROM course )",
"index": 461,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifficulty of a course refers to diff; most difficult course refers to MAX(diff);\nWhat is the name of the most difficult course?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngpa of 3.1 to 3.7 refers to gpa BETWEEN 3.1 AND 3.7; undergraduate students refers to type = 'UG';\nAmong the students with a gpa of 3.1 to 3.7, how many of them are undergraduate students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(student_id) FROM student WHERE gpa BETWEEN 3.1 AND 3.7 AND type = 'UG'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(student_id) FROM student WHERE gpa BETWEEN 3.1 AND 3.7 AND type = 'UG'",
"index": 462,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngpa of 3.1 to 3.7 refers to gpa BETWEEN 3.1 AND 3.7; undergraduate students refers to type = 'UG';\nAmong the students with a gpa of 3.1 to 3.7, how many of them are undergraduate students?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Computer Vision', 'Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the credit of the course named \"Computer Vision\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT credit FROM course WHERE name = 'Computer Vision'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT credit FROM course WHERE name = 'Computer Vision'",
"index": 463,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Computer Vision', 'Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the credit of the course named \"Computer Vision\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Intro to Database 2', 'Intro to Database 1', 'Machine Learning Theory']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n last_name text, -- example: ['Pigford', 'Zhou']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstudent's last name refers to l_name; satisfaction refers to sat; highest satisfaction refers to MAX(sat);\nGive the student's last name that gave the highest student satisfaction for the course \"Intro to Database 2\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Intro to Database 2' ORDER BY T2.sat DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Intro to Database 2' ORDER BY T2.sat DESC LIMIT 1",
"index": 464,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Intro to Database 2', 'Intro to Database 1', 'Machine Learning Theory']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n last_name text, -- example: ['Pigford', 'Zhou']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstudent's last name refers to l_name; satisfaction refers to sat; highest satisfaction refers to MAX(sat);\nGive the student's last name that gave the highest student satisfaction for the course \"Intro to Database 2\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n last_name text, -- example: ['Pigford', 'Zhou']\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['high', 'med']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh salary refers to salary = 'high'; GPA higher than 3 refers to gpa > 3;\nAmong the students with high salary, what is total number of students with a GPA higher than 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(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'high' AND T2.gpa > 3",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'high' AND T2.gpa > 3",
"index": 465,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n last_name text, -- example: ['Pigford', 'Zhou']\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['high', 'med']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh salary refers to salary = 'high'; GPA higher than 3 refers to gpa > 3;\nAmong the students with high salary, what is total number of students with a GPA higher than 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 prof (\n prof_id integer, -- professor id, example: [1, 2]\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUndergraduate students refers to type = 'UG'; satisfaction refers to sat; highest satisfaction refers to MAX(sat);\nAmong undergraduate students, list the name of the course with the highest student satisfaction.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.type = 'UG' ORDER BY T2.sat DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.type = 'UG' ORDER BY T2.sat DESC LIMIT 1",
"index": 466,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['UG', 'RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUndergraduate students refers to type = 'UG'; satisfaction refers to sat; highest satisfaction refers to MAX(sat);\nAmong undergraduate students, list the name of the course with the highest student satisfaction.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['B', 'A']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_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 students with a grade of B, how many of them have an intellegence level of 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(T1.student_id) FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.grade = 'B' AND T2.intelligence = 3",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T1.student_id) FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.grade = 'B' AND T2.intelligence = 3",
"index": 467,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['B', 'A']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_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 students with a grade of B, how many of them have an intellegence level of 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 student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['D', 'A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_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 course's name where students acquired a grade of D.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.name FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'D'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T1.name FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'D'",
"index": 468,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['D', 'A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_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 course's name where students acquired a grade of D.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n popularity integer, -- example: [3, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Alvera', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['McQuillin', 'Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncapability on research refers to capability;\nWhat is the capability on research of the student named Alvera McQuillin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.capability FROM student AS T1 INNER JOIN RA AS T2 ON T1.student_id = T2.student_id WHERE T1.f_name = 'Alvera' AND T1.l_name = 'McQuillin'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T2.capability FROM student AS T1 INNER JOIN RA AS T2 ON T1.student_id = T2.student_id WHERE T1.f_name = 'Alvera' AND T1.l_name = 'McQuillin'",
"index": 469,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n popularity integer, -- example: [3, 2]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Alvera', 'Kerry', 'Chrysa']\n l_name text, -- last name, example: ['McQuillin', 'Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncapability on research refers to capability;\nWhat is the capability on research of the student named Alvera McQuillin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOf courses with 3 credit, how many students have GPA of 3.2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.credit = 3 AND T1.gpa = 3.2",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.credit = 3 AND T1.gpa = 3.2",
"index": 470,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOf courses with 3 credit, how many students have GPA of 3.2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['low', 'med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlow salary refers to salary = 'low';\nAmong students with low salary, how many of them have a gpa of 3.5?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.gpa = 3.5 AND T1.salary = 'low'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.gpa = 3.5 AND T1.salary = 'low'",
"index": 471,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['low', 'med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlow salary refers to salary = 'low';\nAmong students with low salary, how many of them have a gpa of 3.5?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n intelligence integer, -- example: [5, 2]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = AVG(teachingability); most popular professor refers to MAX(popularity);\nWhat is the average teaching ability of the most popular professors?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(teachingability) AS REAL) / COUNT(prof_id) FROM prof WHERE popularity = ( SELECT MAX(popularity) FROM prof )",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT CAST(SUM(teachingability) AS REAL) / COUNT(prof_id) FROM prof WHERE popularity = ( SELECT MAX(popularity) FROM prof )",
"index": 472,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n intelligence integer, -- example: [5, 2]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = AVG(teachingability); most popular professor refers to MAX(popularity);\nWhat is the average teaching ability of the most popular professors?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_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 students = f_name, l_name; above average-capability refers to capability > AVG(capability);\nName the students with above-average capability.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.f_name, T1.l_name FROM student AS T1 INNER JOIN RA AS T2 ON T1.student_id = T2.student_id WHERE T2.capability > ( SELECT AVG(capability) FROM RA )",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN RA AS T2 ON T1.student_id = T2.student_id WHERE T2.capability > ( SELECT AVG(capability) FROM RA )",
"index": 473,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_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 students = f_name, l_name; above average-capability refers to capability > AVG(capability);\nName the students with above-average capability.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_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 capability = AVG(capability); gpa < 2.5;\nWhat is the average capability of students with less than a 2.5 GPA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.capability) AS REAL) / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.gpa < 2.5",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT CAST(SUM(T1.capability) AS REAL) / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.gpa < 2.5",
"index": 474,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_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 capability = AVG(capability); gpa < 2.5;\nWhat is the average capability of students with less than a 2.5 GPA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n intelligence integer, -- example: [5, 2]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name of the professors = first_name, last_name;\nList the full name of the professors who advised students with intelligence 1.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.intelligence = 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.intelligence = 1",
"index": 475,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n intelligence integer, -- example: [5, 2]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name of the professors = first_name, last_name;\nList the full name of the professors who advised students with intelligence 1.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifference in the average gpa = SUBTRACT(AVG(gpa WHERE MAX(diff)), AVG(gpa where min(diff))); difficulty of the course refers to diff; hardest course refers to MAX(diff); easiest course refers to MIN(diff);\nWhat is the difference in the average GPA of students who took the hardest and easiest courses?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.gpa) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.diff IN (2, 1) GROUP BY T3.diff",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT AVG(T1.gpa) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.diff IN (2, 1) GROUP BY T3.diff",
"index": 476,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n PRIMARY KEY (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndifference in the average gpa = SUBTRACT(AVG(gpa WHERE MAX(diff)), AVG(gpa where min(diff))); difficulty of the course refers to diff; hardest course refers to MAX(diff); easiest course refers to MIN(diff);\nWhat is the difference in the average GPA of students who took the hardest and easiest courses?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_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 number of students got an A refers MAX(COUNT(student_id WHERE grade = 'A')); full name = f_name, l_name; got an A refers to grade = 'A';\nPlease give the name of the course in which most numbers of the students got an A. Also, list the full name of the students who got an A in this course.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.name, T2.f_name, T2.l_name FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T1.grade = 'A' GROUP BY T3.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T3.name, T2.f_name, T2.l_name FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T1.grade = 'A' GROUP BY T3.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1",
"index": 477,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_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 number of students got an A refers MAX(COUNT(student_id WHERE grade = 'A')); full name = f_name, l_name; got an A refers to grade = 'A';\nPlease give the name of the course in which most numbers of the students got an A. Also, list the full name of the students who got an A in this course.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than average teaching ability refers to teachingability > AVG(teachingability); full_name of the professor = first_name, last_name; email address of the professor refers to email; advises two or more students refers to COUNT(student_id) > = 2;\n\nAmong the professors with more than average teaching ability, list the full name and email address of the professors who advise two or more students.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T2.last_name, T2.email FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability > ( SELECT AVG(teachingability) FROM prof ) GROUP BY T2.prof_id HAVING COUNT(T1.student_id) >= 2",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T2.first_name, T2.last_name, T2.email FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability > ( SELECT AVG(teachingability) FROM prof ) GROUP BY T2.prof_id HAVING COUNT(T1.student_id) >= 2",
"index": 478,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n popularity integer, -- example: [3, 2]\n teachingability integer, -- example: [5, 1]\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than average teaching ability refers to teachingability > AVG(teachingability); full_name of the professor = first_name, last_name; email address of the professor refers to email; advises two or more students refers to COUNT(student_id) > = 2;\n\nAmong the professors with more than average teaching ability, list the full name and email address of the professors who advise two or more students.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Intro to Database 2', 'Intro to Database 1', 'Machine Learning Theory']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(COUNT(MAX(sat)), (COUNT(student_id))), 1.0); highly satisfied refers to MAX(sat);\nWhat percentage of students are highly satisfied with the Intro to Database 2 course?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(( SELECT COUNT(*) FROM course WHERE name = 'Intro to Database 2' AND course_id IN ( SELECT course_id FROM registration WHERE sat = ( SELECT MAX(sat) FROM registration ) ) ) AS REAL) * 100 / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = 'Intro to Database 2'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT CAST(( SELECT COUNT(*) FROM course WHERE name = 'Intro to Database 2' AND course_id IN ( SELECT course_id FROM registration WHERE sat = ( SELECT MAX(sat) FROM registration ) ) ) AS REAL) * 100 / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = 'Intro to Database 2'",
"index": 479,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Intro to Database 2', 'Intro to Database 1', 'Machine Learning Theory']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(COUNT(MAX(sat)), (COUNT(student_id))), 1.0); highly satisfied refers to MAX(sat);\nWhat percentage of students are highly satisfied with the Intro to Database 2 course?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n PRIMARY KEY (prof_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 name refers of students refers to f_name; last name of students refers to l_name; highest gpa refers to MAX(gpa);\nWhat is the first and last name of students with highest gpa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student )",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student )",
"index": 480,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n phone_number text, -- example: ['(243) 6836472', '(672) 9245255']\n email text, -- example: ['kpryor0@hku.hk', 'cdinehart1@hku.hk']\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n PRIMARY KEY (prof_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 name refers of students refers to f_name; last name of students refers to l_name; highest gpa refers to MAX(gpa);\nWhat is the first and last name of students with highest gpa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['high', 'med']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_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 teachability refers to MAX(teachability); high salary refers to salary = 'high';\nAmong professors with the highest teachability, how many of their students have high salary?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T1.salary = 'high' ORDER BY T2.teachingability DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T1.salary = 'high' ORDER BY T2.teachingability DESC LIMIT 1",
"index": 481,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n teachingability integer, -- example: [5, 1]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['high', 'med']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_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 teachability refers to MAX(teachability); high salary refers to salary = 'high';\nAmong professors with the highest teachability, how many of their students have high salary?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n email text, -- example: ['grosellg@hku.hk', 'kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsalary range refers to salary;\nWhat is the salary range of the student with an email of grosellg@hku.hk?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.salary FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.email = 'grosellg@hku.hk'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T1.salary FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.email = 'grosellg@hku.hk'",
"index": 482,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n email text, -- example: ['grosellg@hku.hk', 'kpryor0@hku.hk', 'cdinehart1@hku.hk']\n intelligence integer, -- example: [5, 2]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n email text, -- example: ['npigford0@hku.hk', 'zzhihua@hku.hk']\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsalary range refers to salary;\nWhat is the salary range of the student with an email of grosellg@hku.hk?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch postgraduate students refers to type = 'RPG'; name of the course refers to name; satisfaction refers to sat; sat = 1;\nAmong research postgraduate students, give the name of the course with the student satisfaction value of 1.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.sat = 1 AND T1.type = 'RPG'",
"style": "rule"
} | {
"db_id": "cs_semester.sqlite",
"gt_sql": "SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.sat = 1 AND T1.type = 'RPG'",
"index": 483,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [1, 2]\n name text, -- example: ['Machine Learning Theory', 'Intro to Database 1']\n credit integer, -- example: [3, 2]\n diff integer, -- difficulty, example: [3, 4]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE prof (\n prof_id integer, -- professor id, example: [1, 2]\n gender text, -- example: ['Male', 'Female']\n first_name text, -- example: ['Nathaniel', 'Zhihua']\n last_name text, -- example: ['Pigford', 'Zhou']\n popularity integer, -- example: [3, 2]\n graduate_from text, -- example: ['University of Washington', 'Beijing Polytechnic University']\n PRIMARY KEY (prof_id)\n);\n\nCREATE TABLE RA (\n student_id integer, -- example: [2, 5]\n capability integer, -- example: [2, 5]\n prof_id integer, -- professor id, example: [7, 10]\n salary text, -- example: ['med', 'high']\n PRIMARY KEY (student_id, prof_id),\n CONSTRAINT fk_ra_student_id FOREIGN KEY (student_id) REFERENCES student (student_id),\n CONSTRAINT fk_ra_prof_id FOREIGN KEY (prof_id) REFERENCES prof (prof_id)\n);\n\nCREATE TABLE registration (\n course_id integer, -- example: [1, 2]\n student_id integer, -- example: [2, 3]\n grade text, -- example: ['A', 'B']\n sat integer, -- satisfying degree, example: [5, 4]\n PRIMARY KEY (course_id, student_id),\n CONSTRAINT fk_registration_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_registration_student_id FOREIGN KEY (student_id) REFERENCES student (student_id)\n);\n\nCREATE TABLE student (\n student_id integer, -- example: [1, 2]\n f_name text, -- first name, example: ['Kerry', 'Chrysa']\n l_name text, -- last name, example: ['Pryor', 'Dine-Hart']\n intelligence integer, -- example: [5, 2]\n gpa real, -- graduate point average, example: [2.4, 2.7]\n type text, -- example: ['RPG', 'TPG']\n PRIMARY KEY (student_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresearch postgraduate students refers to type = 'RPG'; name of the course refers to name; satisfaction refers to sat; sat = 1;\nAmong research postgraduate students, give the name of the course with the student satisfaction value of 1.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n inPhase text, -- example: ['0', 'Post_Quals']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessors refers to taughtBy.p_id; course ID 18 refers to taughtBy.course_id\nHow many professors are teaching course ID 18?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 p_id) FROM taughtBy WHERE course_id = 18",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT p_id) FROM taughtBy WHERE course_id = 18",
"index": 484,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n inPhase text, -- example: ['0', 'Post_Quals']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessors refers to taughtBy.p_id; course ID 18 refers to taughtBy.course_id\nHow many professors are teaching course ID 18?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n hasPosition text, -- example: ['0', 'Faculty']\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_300', 'Level_500']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbasic or medium undergraduate courses refers to courseLevel = 'Level_300'; courses refers to course.course_id\nHow many courses are there for basic or medium undergraduate courses?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(course_id) FROM course WHERE courseLevel = 'Level_300'",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT COUNT(course_id) FROM course WHERE courseLevel = 'Level_300'",
"index": 485,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n hasPosition text, -- example: ['0', 'Faculty']\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_300', 'Level_500']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbasic or medium undergraduate courses refers to courseLevel = 'Level_300'; courses refers to course.course_id\nHow many courses are there for basic or medium undergraduate courses?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_400', 'Level_500', 'Level_300']\n PRIMARY KEY (course_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 professors refers to taughtBy.p_id; high-level or harder undergraduate course refers to courseLevel = 'Level_400'\nProvide the ID of professors who are teaching high-level or harder undergraduate course.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400'",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400'",
"index": 486,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_400', 'Level_500', 'Level_300']\n PRIMARY KEY (course_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 professors refers to taughtBy.p_id; high-level or harder undergraduate course refers to courseLevel = 'Level_400'\nProvide the ID of professors who are teaching high-level or harder undergraduate course.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['0', 'Faculty']\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncourses refers to course_id; advisors refers to p_id_dummy and taughtBy.p_id; student with ID 376 refers to advisedBy.p_id = 376\nWhat are the courses taught by the advisors who gave advice to student with ID 376?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.course_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T1.p_id = 141",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT T3.course_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T1.p_id = 141",
"index": 487,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['0', 'Faculty']\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncourses refers to course_id; advisors refers to p_id_dummy and taughtBy.p_id; student with ID 376 refers to advisedBy.p_id = 376\nWhat are the courses taught by the advisors who gave advice to student with ID 376?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['0', 'Faculty']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessor ID 297 refers to taughtBy.p_id = 297\nWhich level of courses is taught by professor ID 297?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 297",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 297",
"index": 488,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['0', 'Faculty']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessor ID 297 refers to taughtBy.p_id = 297\nWhich level of courses is taught by professor ID 297?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n hasPosition text, -- example: ['Faculty_eme', 'Faculty', '0']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessors who are faculty employees refers to professor = 1; faculty employees refers to hasPosition = 'Faculty_eme'\nState the courses and level of courses by professors who are faculty employees.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.hasPosition = 'Faculty_eme'",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.hasPosition = 'Faculty_eme'",
"index": 489,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n hasPosition text, -- example: ['Faculty_eme', 'Faculty', '0']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessors who are faculty employees refers to professor = 1; faculty employees refers to hasPosition = 'Faculty_eme'\nState the courses and level of courses by professors who are faculty employees.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['0', 'Faculty']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_400', 'Level_300']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nharder undergraduate course refers to courseLevel = 'Level_400'; master/graduate courses refers to courseLevel = 'Level_500'; ID of professors refers to taughtBy.p_id\nProvide the ID of professors who teach in both harder undergraduate course and master/graduate courses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400' OR T1.courseLevel = 'Level_500'",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT DISTINCT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400' OR T1.courseLevel = 'Level_500'",
"index": 490,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['0', 'Faculty']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_400', 'Level_300']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nharder undergraduate course refers to courseLevel = 'Level_400'; master/graduate courses refers to courseLevel = 'Level_500'; ID of professors refers to taughtBy.p_id\nProvide the ID of professors who teach in both harder undergraduate course and master/graduate courses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['Year_12', '0', 'Year_2']\n PRIMARY KEY (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessors refers to p_id_dummy; 12th years of program refers to yearsInProgram = 'Year_12'\nWho are the professors who gave advice to students in the 12th years of program?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_12'",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_12'",
"index": 491,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['Year_12', '0', 'Year_2']\n PRIMARY KEY (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessors refers to p_id_dummy; 12th years of program refers to yearsInProgram = 'Year_12'\nWho are the professors who gave advice to students in the 12th years of program?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n inPhase text, -- example: ['0', 'Post_Quals']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncourses refers taughtBy.course_id; most number of professors refers to max(count(taughtBy.p_id)); level of the course refers to courseLevel\nWhich are the courses with the most number of professors? State the course ID and the level of the course.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id, T1.courseLevel ORDER BY COUNT(T1.course_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id, T1.courseLevel ORDER BY COUNT(T1.course_id) DESC LIMIT 1",
"index": 492,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n inPhase text, -- example: ['0', 'Post_Quals']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncourses refers taughtBy.course_id; most number of professors refers to max(count(taughtBy.p_id)); level of the course refers to courseLevel\nWhich are the courses with the most number of professors? State the course ID and the level of the course.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['0', 'Faculty']\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteachers refers to p_id_dummy; have advised more than 4 others refers to count(advisedBy.p_id) > 4\nPlease list the IDs of the teachers who have advised more than 4 others to teach.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(p_id_dummy) > 4",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(p_id_dummy) > 4",
"index": 493,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['0', 'Faculty']\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteachers refers to p_id_dummy; have advised more than 4 others refers to count(advisedBy.p_id) > 4\nPlease list the IDs of the teachers who have advised more than 4 others to teach.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n hasPosition text, -- example: ['Faculty_eme', 'Faculty', '0']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_300', 'Level_500']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfaculty employees refers to hasPosition = 'Faculty_eme'; basic or medium undergraduate course refers to courseLevel = 'Level_300'\nPlease list the IDs of all the faculty employees who teaches a basic or medium undergraduate course.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T1.courseLevel = 'Level_300' AND T3.hasPosition = 'Faculty_eme'",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T1.courseLevel = 'Level_300' AND T3.hasPosition = 'Faculty_eme'",
"index": 494,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n hasPosition text, -- example: ['Faculty_eme', 'Faculty', '0']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_300', 'Level_500']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfaculty employees refers to hasPosition = 'Faculty_eme'; basic or medium undergraduate course refers to courseLevel = 'Level_300'\nPlease list the IDs of all the faculty employees who teaches a basic or medium undergraduate course.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 p_id integer, -- person ID, example: [3, 4]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['Faculty', '0']\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteacher refers to taughtBy.p_id; course no.9 refers to taughtBy.course_id = 9; faculty member refers to hasPosition ! = 0\nIs the teacher who teaches course no.9 a faculty member?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.hasPosition FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.course_id = 9",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT T2.hasPosition FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.course_id = 9",
"index": 495,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 p_id integer, -- person ID, example: [3, 4]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['Faculty', '0']\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteacher refers to taughtBy.p_id; course no.9 refers to taughtBy.course_id = 9; faculty member refers to hasPosition ! = 0\nIs the teacher who teaches course no.9 a faculty member?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_300', 'Level_500']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['Faculty', '0']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncourses that are basic or medium undergraduate courses refers to courseLevel = 'Level_300'; faculty member refers to hasPosition ! = 0\nAmong the courses that are basic or medium undergraduate courses, how many of them are taught by a faculty member?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.professor = 1 AND T1.courseLevel = 'Level_300'",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.professor = 1 AND T1.courseLevel = 'Level_300'",
"index": 496,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_300', 'Level_500']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['Faculty', '0']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncourses that are basic or medium undergraduate courses refers to courseLevel = 'Level_300'; faculty member refers to hasPosition ! = 0\nAmong the courses that are basic or medium undergraduate courses, how many of them are taught by a faculty member?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['0', 'Faculty']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessor refers to p_id_dummy and professor = 1; student no.6 refers to advisedBy.p_id = 6; IDs of the courses refers to taughtBy.course_id\nFor the professor who advised student no.6, please list the IDs of the courses he or she teaches.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T3.p_id = T1.p_id WHERE T1.p_id = 9",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT T2.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T3.p_id = T1.p_id WHERE T1.p_id = 9",
"index": 497,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n student integer, -- example: [1, 0]\n hasPosition text, -- example: ['0', 'Faculty']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofessor refers to p_id_dummy and professor = 1; student no.6 refers to advisedBy.p_id = 6; IDs of the courses refers to taughtBy.course_id\nFor the professor who advised student no.6, please list the IDs of the courses he or she teaches.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIDs of the professors refers to taughtBy.p_id and professor = 1; teaches more than 3 courses refers to count(course_id) > 3\nPlease list the IDs of the professors that teaches more than 3 courses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1 GROUP BY T1.p_id HAVING COUNT(DISTINCT T1.course_id) > 3",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1 GROUP BY T1.p_id HAVING COUNT(DISTINCT T1.course_id) > 3",
"index": 498,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIDs of the professors refers to taughtBy.p_id and professor = 1; teaches more than 3 courses refers to count(course_id) > 3\nPlease list the IDs of the professors that teaches more than 3 courses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIDs of the professors refers to taughtBy.p_id and professor = 1; teaches the most courses refers to max(count(course_id))\nPlease list the IDs of the top 3 professors that teaches the most courses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1 GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 3",
"style": "rule"
} | {
"db_id": "computer_student.sqlite",
"gt_sql": "SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1 GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 3",
"index": 499,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE taughtBy (\n course_id integer, -- example: [0, 1]\n p_id integer, -- person ID, example: [40, 180]\n PRIMARY KEY (course_id, p_id),\n CONSTRAINT fk_taughtby_course_id FOREIGN KEY (course_id) REFERENCES course (course_id),\n CONSTRAINT fk_taughtby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id)\n);\n\nCREATE TABLE course (\n course_id integer, -- example: [0, 1]\n courseLevel text, -- example: ['Level_500', 'Level_300']\n PRIMARY KEY (course_id)\n);\n\nCREATE TABLE person (\n p_id integer, -- person ID, example: [3, 4]\n professor integer, -- example: [0, 1]\n inPhase text, -- example: ['0', 'Post_Quals']\n yearsInProgram text, -- example: ['0', 'Year_2']\n PRIMARY KEY (p_id)\n);\n\nCREATE TABLE advisedBy (\n p_id integer, -- person id, example: [6, 9]\n p_id_dummy integer, -- person id dummy, example: [5, 7]\n PRIMARY KEY (p_id, p_id_dummy),\n CONSTRAINT fk_advisedby_p_id FOREIGN KEY (p_id) REFERENCES person (p_id),\n CONSTRAINT fk_advisedby_p_id_dummy FOREIGN KEY (p_id_dummy) REFERENCES person (p_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIDs of the professors refers to taughtBy.p_id and professor = 1; teaches the most courses refers to max(count(course_id))\nPlease list the IDs of the top 3 professors that teaches the most courses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\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.