sharkiefff/RBAC-Text2SQL-Benchmark huggingface dataset:
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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 paragraph texts for the document with the name 'Customer reviews'?
Answer: Sorry, I cannot answer.
Permission: denied (Missing column permissions: paragraphs: paragraph_text)
Gold SQL: SELECT T1.paragraph_text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id WHERE T2.document_name  =  "Customer reviews"
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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: Show all document ids and the number of paragraphs in each document. Order by document id.
Answer: SELECT document_id ,  count(*) FROM Paragraphs GROUP BY document_id ORDER BY document_id
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT document_id ,  count(*) FROM Paragraphs GROUP BY document_id ORDER BY document_id
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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 different document ids along with the number of paragraphs corresponding to each, ordered by id.
Answer: SELECT document_id ,  count(*) FROM Paragraphs GROUP BY document_id ORDER BY document_id
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT document_id ,  count(*) FROM Paragraphs GROUP BY document_id ORDER BY document_id
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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: Show all document ids, names and the number of paragraphs in each document.
Answer: SELECT T1.document_id ,  T2.document_name ,  count(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id GROUP BY T1.document_id
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.document_id ,  T2.document_name ,  count(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id GROUP BY T1.document_id
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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 names of each document, as well as the number of paragraphs in each?
Answer: SELECT T1.document_id ,  T2.document_name ,  count(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id GROUP BY T1.document_id
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.document_id ,  T2.document_name ,  count(*) FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id GROUP BY T1.document_id
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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 all document ids with at least two paragraphs.
Answer: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*)  >=  2
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*)  >=  2
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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 of documents that have 2 or more paragraphs?
Answer: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*)  >=  2
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*)  >=  2
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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 document id and name with greatest number of paragraphs?
Answer: SELECT T1.document_id ,  T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id GROUP BY T1.document_id ORDER BY count(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.document_id ,  T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id GROUP BY T1.document_id ORDER BY count(*) DESC LIMIT 1
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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 id and name of the document with the most paragraphs.
Answer: SELECT T1.document_id ,  T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id GROUP BY T1.document_id ORDER BY count(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.document_id ,  T2.document_name FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.document_id  =  T2.document_id GROUP BY T1.document_id ORDER BY count(*) DESC LIMIT 1
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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 document id with least number of paragraphs?
Answer: SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY count(*) ASC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY count(*) ASC LIMIT 1
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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 id of the document with the fewest paragraphs.
Answer: SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY count(*) ASC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY count(*) ASC LIMIT 1
##Instruction:
Database: cre_Doc_Template_Mgt
Total Tables: 4
Total Columns: 17

Table Schemas:

cre_Doc_Template_Mgt contains tables such as Ref_Template_Types, Templates, Documents, Paragraphs.
Table Ref_Template_Types has columns such as Template_Type_Code, Template_Type_Description.
Template_Type_Code is the primary key.
Table Templates has columns such as Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details.
Template_ID is the primary key.
Table Documents has columns such as Document_ID, Template_ID, Document_Name, Document_Description, Other_Details.
Document_ID is the primary key.
Table Paragraphs has columns such as Paragraph_ID, Document_ID, Paragraph_Text, Other_Details.
Paragraph_ID is the primary key.
The Template_Type_Code of Templates is the foreign key of Template_Type_Code of Ref_Template_Types.
The Template_ID of Documents is the foreign key of Template_ID of Templates.
The Document_ID of Paragraphs is the foreign key of Document_ID of Documents.

##Role Access Policy (Column-Level):
Role: TemplateAuditor
Accessible Columns: Ref_Template_Types: Template_Type_Code, Template_Type_Description; Templates: Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To; Documents: Document_ID, Template_ID, Document_Name; Paragraphs: Paragraph_ID, Document_ID

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 document id with 1 to 2 paragraphs?
Answer: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*) BETWEEN 1 AND 2
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT document_id FROM Paragraphs GROUP BY document_id HAVING count(*) BETWEEN 1 AND 2