sharkiefff/RBAC-Text2SQL-Benchmark huggingface dataset:
##Instruction:
Database: cre_Docs_and_Epenses
Total Tables: 7
Total Columns: 22

Table Schemas:

cre_Docs_and_Epenses contains tables such as Ref_Document_Types, Ref_Budget_Codes, Projects, Documents, Statements, Documents_with_Expenses, Accounts.
Table Ref_Document_Types has columns such as Document_Type_Code, Document_Type_Name, Document_Type_Description.
Document_Type_Code is the primary key.
Table Ref_Budget_Codes has columns such as Budget_Type_Code, Budget_Type_Description.
Budget_Type_Code is the primary key.
Table Projects has columns such as Project_ID, Project_Details.
Project_ID is the primary key.
Table Documents has columns such as Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Statements has columns such as Statement_ID, Statement_Details.
Statement_ID is the primary key.
Table Documents_with_Expenses has columns such as Document_ID, Budget_Type_Code, Document_Details.
Document_ID is the primary key.
Table Accounts has columns such as Account_ID, Statement_ID, Account_Details.
Account_ID is the primary key.
The Project_ID of Documents is the foreign key of Project_ID of Projects.
The Document_Type_Code of Documents is the foreign key of Document_Type_Code of Ref_Document_Types.
The Statement_ID of Statements is the foreign key of Document_ID of Documents.
The Document_ID of Documents_with_Expenses is the foreign key of Document_ID of Documents.
The Budget_Type_Code of Documents_with_Expenses is the foreign key of Budget_Type_Code of Ref_Budget_Codes.
The Statement_ID of Accounts is the foreign key of Statement_ID of Statements.

##Role Access Policy (Column-Level):
Role: DocumentManager
Accessible Columns: Ref_Document_Types: ALL COLUMNS; Projects: Project_ID, Project_Details; Documents: Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: How many projects are there?
Answer: SELECT count(*) FROM Projects
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT count(*) FROM Projects
##Instruction:
Database: cre_Docs_and_Epenses
Total Tables: 7
Total Columns: 22

Table Schemas:

cre_Docs_and_Epenses contains tables such as Ref_Document_Types, Ref_Budget_Codes, Projects, Documents, Statements, Documents_with_Expenses, Accounts.
Table Ref_Document_Types has columns such as Document_Type_Code, Document_Type_Name, Document_Type_Description.
Document_Type_Code is the primary key.
Table Ref_Budget_Codes has columns such as Budget_Type_Code, Budget_Type_Description.
Budget_Type_Code is the primary key.
Table Projects has columns such as Project_ID, Project_Details.
Project_ID is the primary key.
Table Documents has columns such as Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Statements has columns such as Statement_ID, Statement_Details.
Statement_ID is the primary key.
Table Documents_with_Expenses has columns such as Document_ID, Budget_Type_Code, Document_Details.
Document_ID is the primary key.
Table Accounts has columns such as Account_ID, Statement_ID, Account_Details.
Account_ID is the primary key.
The Project_ID of Documents is the foreign key of Project_ID of Projects.
The Document_Type_Code of Documents is the foreign key of Document_Type_Code of Ref_Document_Types.
The Statement_ID of Statements is the foreign key of Document_ID of Documents.
The Document_ID of Documents_with_Expenses is the foreign key of Document_ID of Documents.
The Budget_Type_Code of Documents_with_Expenses is the foreign key of Budget_Type_Code of Ref_Budget_Codes.
The Statement_ID of Accounts is the foreign key of Statement_ID of Statements.

##Role Access Policy (Column-Level):
Role: DocumentManager
Accessible Columns: Ref_Document_Types: ALL COLUMNS; Projects: Project_ID, Project_Details; Documents: Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: List ids and details for all projects.
Answer: SELECT project_id ,  project_details FROM Projects
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT project_id ,  project_details FROM Projects
##Instruction:
Database: cre_Docs_and_Epenses
Total Tables: 7
Total Columns: 22

Table Schemas:

cre_Docs_and_Epenses contains tables such as Ref_Document_Types, Ref_Budget_Codes, Projects, Documents, Statements, Documents_with_Expenses, Accounts.
Table Ref_Document_Types has columns such as Document_Type_Code, Document_Type_Name, Document_Type_Description.
Document_Type_Code is the primary key.
Table Ref_Budget_Codes has columns such as Budget_Type_Code, Budget_Type_Description.
Budget_Type_Code is the primary key.
Table Projects has columns such as Project_ID, Project_Details.
Project_ID is the primary key.
Table Documents has columns such as Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Statements has columns such as Statement_ID, Statement_Details.
Statement_ID is the primary key.
Table Documents_with_Expenses has columns such as Document_ID, Budget_Type_Code, Document_Details.
Document_ID is the primary key.
Table Accounts has columns such as Account_ID, Statement_ID, Account_Details.
Account_ID is the primary key.
The Project_ID of Documents is the foreign key of Project_ID of Projects.
The Document_Type_Code of Documents is the foreign key of Document_Type_Code of Ref_Document_Types.
The Statement_ID of Statements is the foreign key of Document_ID of Documents.
The Document_ID of Documents_with_Expenses is the foreign key of Document_ID of Documents.
The Budget_Type_Code of Documents_with_Expenses is the foreign key of Budget_Type_Code of Ref_Budget_Codes.
The Statement_ID of Accounts is the foreign key of Statement_ID of Statements.

##Role Access Policy (Column-Level):
Role: DocumentManager
Accessible Columns: Ref_Document_Types: ALL COLUMNS; Projects: Project_ID, Project_Details; Documents: Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: What are the ids and details for each project?
Answer: SELECT project_id ,  project_details FROM Projects
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT project_id ,  project_details FROM Projects
##Instruction:
Database: cre_Docs_and_Epenses
Total Tables: 7
Total Columns: 22

Table Schemas:

cre_Docs_and_Epenses contains tables such as Ref_Document_Types, Ref_Budget_Codes, Projects, Documents, Statements, Documents_with_Expenses, Accounts.
Table Ref_Document_Types has columns such as Document_Type_Code, Document_Type_Name, Document_Type_Description.
Document_Type_Code is the primary key.
Table Ref_Budget_Codes has columns such as Budget_Type_Code, Budget_Type_Description.
Budget_Type_Code is the primary key.
Table Projects has columns such as Project_ID, Project_Details.
Project_ID is the primary key.
Table Documents has columns such as Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Statements has columns such as Statement_ID, Statement_Details.
Statement_ID is the primary key.
Table Documents_with_Expenses has columns such as Document_ID, Budget_Type_Code, Document_Details.
Document_ID is the primary key.
Table Accounts has columns such as Account_ID, Statement_ID, Account_Details.
Account_ID is the primary key.
The Project_ID of Documents is the foreign key of Project_ID of Projects.
The Document_Type_Code of Documents is the foreign key of Document_Type_Code of Ref_Document_Types.
The Statement_ID of Statements is the foreign key of Document_ID of Documents.
The Document_ID of Documents_with_Expenses is the foreign key of Document_ID of Documents.
The Budget_Type_Code of Documents_with_Expenses is the foreign key of Budget_Type_Code of Ref_Budget_Codes.
The Statement_ID of Accounts is the foreign key of Statement_ID of Statements.

##Role Access Policy (Column-Level):
Role: DocumentManager
Accessible Columns: Ref_Document_Types: ALL COLUMNS; Projects: Project_ID, Project_Details; Documents: Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: What is the project id and detail for the project with at least two documents?
Answer: SELECT T1.project_id ,  T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.project_id HAVING count(*)  >  2
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.project_id ,  T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.project_id HAVING count(*)  >  2
##Instruction:
Database: cre_Docs_and_Epenses
Total Tables: 7
Total Columns: 22

Table Schemas:

cre_Docs_and_Epenses contains tables such as Ref_Document_Types, Ref_Budget_Codes, Projects, Documents, Statements, Documents_with_Expenses, Accounts.
Table Ref_Document_Types has columns such as Document_Type_Code, Document_Type_Name, Document_Type_Description.
Document_Type_Code is the primary key.
Table Ref_Budget_Codes has columns such as Budget_Type_Code, Budget_Type_Description.
Budget_Type_Code is the primary key.
Table Projects has columns such as Project_ID, Project_Details.
Project_ID is the primary key.
Table Documents has columns such as Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Statements has columns such as Statement_ID, Statement_Details.
Statement_ID is the primary key.
Table Documents_with_Expenses has columns such as Document_ID, Budget_Type_Code, Document_Details.
Document_ID is the primary key.
Table Accounts has columns such as Account_ID, Statement_ID, Account_Details.
Account_ID is the primary key.
The Project_ID of Documents is the foreign key of Project_ID of Projects.
The Document_Type_Code of Documents is the foreign key of Document_Type_Code of Ref_Document_Types.
The Statement_ID of Statements is the foreign key of Document_ID of Documents.
The Document_ID of Documents_with_Expenses is the foreign key of Document_ID of Documents.
The Budget_Type_Code of Documents_with_Expenses is the foreign key of Budget_Type_Code of Ref_Budget_Codes.
The Statement_ID of Accounts is the foreign key of Statement_ID of Statements.

##Role Access Policy (Column-Level):
Role: DocumentManager
Accessible Columns: Ref_Document_Types: ALL COLUMNS; Projects: Project_ID, Project_Details; Documents: Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: Return the ids and details corresponding to projects for which there are more than two documents.
Answer: SELECT T1.project_id ,  T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.project_id HAVING count(*)  >  2
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.project_id ,  T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id  =  T2.project_id GROUP BY T1.project_id HAVING count(*)  >  2
##Instruction:
Database: cre_Docs_and_Epenses
Total Tables: 7
Total Columns: 22

Table Schemas:

cre_Docs_and_Epenses contains tables such as Ref_Document_Types, Ref_Budget_Codes, Projects, Documents, Statements, Documents_with_Expenses, Accounts.
Table Ref_Document_Types has columns such as Document_Type_Code, Document_Type_Name, Document_Type_Description.
Document_Type_Code is the primary key.
Table Ref_Budget_Codes has columns such as Budget_Type_Code, Budget_Type_Description.
Budget_Type_Code is the primary key.
Table Projects has columns such as Project_ID, Project_Details.
Project_ID is the primary key.
Table Documents has columns such as Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Statements has columns such as Statement_ID, Statement_Details.
Statement_ID is the primary key.
Table Documents_with_Expenses has columns such as Document_ID, Budget_Type_Code, Document_Details.
Document_ID is the primary key.
Table Accounts has columns such as Account_ID, Statement_ID, Account_Details.
Account_ID is the primary key.
The Project_ID of Documents is the foreign key of Project_ID of Projects.
The Document_Type_Code of Documents is the foreign key of Document_Type_Code of Ref_Document_Types.
The Statement_ID of Statements is the foreign key of Document_ID of Documents.
The Document_ID of Documents_with_Expenses is the foreign key of Document_ID of Documents.
The Budget_Type_Code of Documents_with_Expenses is the foreign key of Budget_Type_Code of Ref_Budget_Codes.
The Statement_ID of Accounts is the foreign key of Statement_ID of Statements.

##Role Access Policy (Column-Level):
Role: DocumentManager
Accessible Columns: Ref_Document_Types: ALL COLUMNS; Projects: Project_ID, Project_Details; Documents: Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: What is the project detail for the project with document "King Book"?
Answer: SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id  =  T2.project_id WHERE T2.document_name  =  "King Book"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id  =  T2.project_id WHERE T2.document_name  =  "King Book"
##Instruction:
Database: cre_Docs_and_Epenses
Total Tables: 7
Total Columns: 22

Table Schemas:

cre_Docs_and_Epenses contains tables such as Ref_Document_Types, Ref_Budget_Codes, Projects, Documents, Statements, Documents_with_Expenses, Accounts.
Table Ref_Document_Types has columns such as Document_Type_Code, Document_Type_Name, Document_Type_Description.
Document_Type_Code is the primary key.
Table Ref_Budget_Codes has columns such as Budget_Type_Code, Budget_Type_Description.
Budget_Type_Code is the primary key.
Table Projects has columns such as Project_ID, Project_Details.
Project_ID is the primary key.
Table Documents has columns such as Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Statements has columns such as Statement_ID, Statement_Details.
Statement_ID is the primary key.
Table Documents_with_Expenses has columns such as Document_ID, Budget_Type_Code, Document_Details.
Document_ID is the primary key.
Table Accounts has columns such as Account_ID, Statement_ID, Account_Details.
Account_ID is the primary key.
The Project_ID of Documents is the foreign key of Project_ID of Projects.
The Document_Type_Code of Documents is the foreign key of Document_Type_Code of Ref_Document_Types.
The Statement_ID of Statements is the foreign key of Document_ID of Documents.
The Document_ID of Documents_with_Expenses is the foreign key of Document_ID of Documents.
The Budget_Type_Code of Documents_with_Expenses is the foreign key of Budget_Type_Code of Ref_Budget_Codes.
The Statement_ID of Accounts is the foreign key of Statement_ID of Statements.

##Role Access Policy (Column-Level):
Role: DocumentManager
Accessible Columns: Ref_Document_Types: ALL COLUMNS; Projects: Project_ID, Project_Details; Documents: Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: Give the details of the project with the document name 'King Book'.
Answer: SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id  =  T2.project_id WHERE T2.document_name  =  "King Book"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id  =  T2.project_id WHERE T2.document_name  =  "King Book"
##Instruction:
Database: cre_Docs_and_Epenses
Total Tables: 7
Total Columns: 22

Table Schemas:

cre_Docs_and_Epenses contains tables such as Ref_Document_Types, Ref_Budget_Codes, Projects, Documents, Statements, Documents_with_Expenses, Accounts.
Table Ref_Document_Types has columns such as Document_Type_Code, Document_Type_Name, Document_Type_Description.
Document_Type_Code is the primary key.
Table Ref_Budget_Codes has columns such as Budget_Type_Code, Budget_Type_Description.
Budget_Type_Code is the primary key.
Table Projects has columns such as Project_ID, Project_Details.
Project_ID is the primary key.
Table Documents has columns such as Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Statements has columns such as Statement_ID, Statement_Details.
Statement_ID is the primary key.
Table Documents_with_Expenses has columns such as Document_ID, Budget_Type_Code, Document_Details.
Document_ID is the primary key.
Table Accounts has columns such as Account_ID, Statement_ID, Account_Details.
Account_ID is the primary key.
The Project_ID of Documents is the foreign key of Project_ID of Projects.
The Document_Type_Code of Documents is the foreign key of Document_Type_Code of Ref_Document_Types.
The Statement_ID of Statements is the foreign key of Document_ID of Documents.
The Document_ID of Documents_with_Expenses is the foreign key of Document_ID of Documents.
The Budget_Type_Code of Documents_with_Expenses is the foreign key of Budget_Type_Code of Ref_Budget_Codes.
The Statement_ID of Accounts is the foreign key of Statement_ID of Statements.

##Role Access Policy (Column-Level):
Role: DocumentManager
Accessible Columns: Ref_Document_Types: ALL COLUMNS; Projects: Project_ID, Project_Details; Documents: Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: How many budget types do we have?
Answer: SELECT count(*) FROM Ref_budget_codes
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT count(*) FROM Ref_budget_codes
##Instruction:
Database: cre_Docs_and_Epenses
Total Tables: 7
Total Columns: 22

Table Schemas:

cre_Docs_and_Epenses contains tables such as Ref_Document_Types, Ref_Budget_Codes, Projects, Documents, Statements, Documents_with_Expenses, Accounts.
Table Ref_Document_Types has columns such as Document_Type_Code, Document_Type_Name, Document_Type_Description.
Document_Type_Code is the primary key.
Table Ref_Budget_Codes has columns such as Budget_Type_Code, Budget_Type_Description.
Budget_Type_Code is the primary key.
Table Projects has columns such as Project_ID, Project_Details.
Project_ID is the primary key.
Table Documents has columns such as Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Statements has columns such as Statement_ID, Statement_Details.
Statement_ID is the primary key.
Table Documents_with_Expenses has columns such as Document_ID, Budget_Type_Code, Document_Details.
Document_ID is the primary key.
Table Accounts has columns such as Account_ID, Statement_ID, Account_Details.
Account_ID is the primary key.
The Project_ID of Documents is the foreign key of Project_ID of Projects.
The Document_Type_Code of Documents is the foreign key of Document_Type_Code of Ref_Document_Types.
The Statement_ID of Statements is the foreign key of Document_ID of Documents.
The Document_ID of Documents_with_Expenses is the foreign key of Document_ID of Documents.
The Budget_Type_Code of Documents_with_Expenses is the foreign key of Budget_Type_Code of Ref_Budget_Codes.
The Statement_ID of Accounts is the foreign key of Statement_ID of Statements.

##Role Access Policy (Column-Level):
Role: DocumentManager
Accessible Columns: Ref_Document_Types: ALL COLUMNS; Projects: Project_ID, Project_Details; Documents: Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: Count the number of budget codes.
Answer: SELECT count(*) FROM Ref_budget_codes
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT count(*) FROM Ref_budget_codes