sharkiefff/RBAC-Text2SQL-Benchmark huggingface dataset:
##Instruction:
Database: party_host
Total Tables: 3
Total Columns: 13

Table Schemas:

party_host contains tables such as party, host, party_host.
Table party has columns such as Party_ID, Party_Theme, Location, First_year, Last_year, Number_of_hosts.
Party_ID is the primary key.
Table host has columns such as Host_ID, Name, Nationality, Age.
Host_ID is the primary key.
Table party_host has columns such as Party_ID, Host_ID, Is_Main_in_Charge.
Party_ID is the primary key.
The Party_ID of party_host is the foreign key of Party_ID of party.
The Host_ID of party_host is the foreign key of Host_ID of host.

##Role Access Policy (Column-Level):
Role: HRManager
Accessible Columns: host: Host_ID, Name, Nationality, Age; party_host: Host_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 the name and the nationality of the oldest host.
Answer: SELECT Name ,  Nationality FROM HOST ORDER BY Age DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Name ,  Nationality FROM HOST ORDER BY Age DESC LIMIT 1
##Instruction:
Database: party_host
Total Tables: 3
Total Columns: 13

Table Schemas:

party_host contains tables such as party, host, party_host.
Table party has columns such as Party_ID, Party_Theme, Location, First_year, Last_year, Number_of_hosts.
Party_ID is the primary key.
Table host has columns such as Host_ID, Name, Nationality, Age.
Host_ID is the primary key.
Table party_host has columns such as Party_ID, Host_ID, Is_Main_in_Charge.
Party_ID is the primary key.
The Party_ID of party_host is the foreign key of Party_ID of party.
The Host_ID of party_host is the foreign key of Host_ID of host.

##Role Access Policy (Column-Level):
Role: HRManager
Accessible Columns: host: Host_ID, Name, Nationality, Age; party_host: Host_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 name and the nationality of the host of the highest age?
Answer: SELECT Name ,  Nationality FROM HOST ORDER BY Age DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Name ,  Nationality FROM HOST ORDER BY Age DESC LIMIT 1
##Instruction:
Database: party_host
Total Tables: 3
Total Columns: 13

Table Schemas:

party_host contains tables such as party, host, party_host.
Table party has columns such as Party_ID, Party_Theme, Location, First_year, Last_year, Number_of_hosts.
Party_ID is the primary key.
Table host has columns such as Host_ID, Name, Nationality, Age.
Host_ID is the primary key.
Table party_host has columns such as Party_ID, Host_ID, Is_Main_in_Charge.
Party_ID is the primary key.
The Party_ID of party_host is the foreign key of Party_ID of party.
The Host_ID of party_host is the foreign key of Host_ID of host.

##Role Access Policy (Column-Level):
Role: HRManager
Accessible Columns: host: Host_ID, Name, Nationality, Age; party_host: Host_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 the names of hosts who did not serve as a host of any party in our record.
Answer: SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host)
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host)
##Instruction:
Database: party_host
Total Tables: 3
Total Columns: 13

Table Schemas:

party_host contains tables such as party, host, party_host.
Table party has columns such as Party_ID, Party_Theme, Location, First_year, Last_year, Number_of_hosts.
Party_ID is the primary key.
Table host has columns such as Host_ID, Name, Nationality, Age.
Host_ID is the primary key.
Table party_host has columns such as Party_ID, Host_ID, Is_Main_in_Charge.
Party_ID is the primary key.
The Party_ID of party_host is the foreign key of Party_ID of party.
The Host_ID of party_host is the foreign key of Host_ID of host.

##Role Access Policy (Column-Level):
Role: HRManager
Accessible Columns: host: Host_ID, Name, Nationality, Age; party_host: Host_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 names of hosts who did not host any party in our record?
Answer: SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host)
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host)
##Instruction:
Database: insurance_and_eClaims
Total Tables: 7
Total Columns: 30

Table Schemas:

insurance_and_eClaims contains tables such as Customers, Staff, Policies, Claim_Headers, Claims_Documents, Claims_Processing_Stages, Claims_Processing.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Staff has columns such as Staff_ID, Staff_Details.
Staff_ID is the primary key.
Table Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claim_Headers has columns such as Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim, Date_of_Settlement, Amount_Claimed, Amount_Piad.
Claim_Header_ID is the primary key.
Table Claims_Documents has columns such as Claim_ID, Document_Type_Code, Created_by_Staff_ID, Created_Date.
Claim_ID is the primary key.
Table Claims_Processing_Stages has columns such as Claim_Stage_ID, Next_Claim_Stage_ID, Claim_Status_Name, Claim_Status_Description.
Claim_Stage_ID is the primary key.
Table Claims_Processing has columns such as Claim_Processing_ID, Claim_ID, Claim_Outcome_Code, Claim_Stage_ID, Staff_ID.
Claim_Processing_ID is the primary key.
The Customer_ID of Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claim_Headers is the foreign key of Policy_ID of Policies.
The Created_by_Staff_ID of Claims_Documents is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Documents is the foreign key of Claim_Header_ID of Claim_Headers.
The Staff_ID of Claims_Processing is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Processing is the foreign key of Claim_Header_ID of Claim_Headers.

##Role Access Policy (Column-Level):
Role: CustomerServiceAgent
Accessible Columns: Customers: Customer_ID, Customer_Details; Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claim_Headers: Claim_Header_ID, Claim_Status_Code, Policy_ID, Date_of_Claim; Staff: Staff_ID, Staff_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 the names of all the customers in alphabetical order.
Answer: SELECT customer_details FROM customers ORDER BY customer_details
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT customer_details FROM customers ORDER BY customer_details
##Instruction:
Database: insurance_and_eClaims
Total Tables: 7
Total Columns: 30

Table Schemas:

insurance_and_eClaims contains tables such as Customers, Staff, Policies, Claim_Headers, Claims_Documents, Claims_Processing_Stages, Claims_Processing.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Staff has columns such as Staff_ID, Staff_Details.
Staff_ID is the primary key.
Table Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claim_Headers has columns such as Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim, Date_of_Settlement, Amount_Claimed, Amount_Piad.
Claim_Header_ID is the primary key.
Table Claims_Documents has columns such as Claim_ID, Document_Type_Code, Created_by_Staff_ID, Created_Date.
Claim_ID is the primary key.
Table Claims_Processing_Stages has columns such as Claim_Stage_ID, Next_Claim_Stage_ID, Claim_Status_Name, Claim_Status_Description.
Claim_Stage_ID is the primary key.
Table Claims_Processing has columns such as Claim_Processing_ID, Claim_ID, Claim_Outcome_Code, Claim_Stage_ID, Staff_ID.
Claim_Processing_ID is the primary key.
The Customer_ID of Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claim_Headers is the foreign key of Policy_ID of Policies.
The Created_by_Staff_ID of Claims_Documents is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Documents is the foreign key of Claim_Header_ID of Claim_Headers.
The Staff_ID of Claims_Processing is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Processing is the foreign key of Claim_Header_ID of Claim_Headers.

##Role Access Policy (Column-Level):
Role: CustomerServiceAgent
Accessible Columns: Customers: Customer_ID, Customer_Details; Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claim_Headers: Claim_Header_ID, Claim_Status_Code, Policy_ID, Date_of_Claim; Staff: Staff_ID, Staff_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: Sort the customer names in alphabetical order.
Answer: SELECT customer_details FROM customers ORDER BY customer_details
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT customer_details FROM customers ORDER BY customer_details
##Instruction:
Database: insurance_and_eClaims
Total Tables: 7
Total Columns: 30

Table Schemas:

insurance_and_eClaims contains tables such as Customers, Staff, Policies, Claim_Headers, Claims_Documents, Claims_Processing_Stages, Claims_Processing.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Staff has columns such as Staff_ID, Staff_Details.
Staff_ID is the primary key.
Table Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claim_Headers has columns such as Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim, Date_of_Settlement, Amount_Claimed, Amount_Piad.
Claim_Header_ID is the primary key.
Table Claims_Documents has columns such as Claim_ID, Document_Type_Code, Created_by_Staff_ID, Created_Date.
Claim_ID is the primary key.
Table Claims_Processing_Stages has columns such as Claim_Stage_ID, Next_Claim_Stage_ID, Claim_Status_Name, Claim_Status_Description.
Claim_Stage_ID is the primary key.
Table Claims_Processing has columns such as Claim_Processing_ID, Claim_ID, Claim_Outcome_Code, Claim_Stage_ID, Staff_ID.
Claim_Processing_ID is the primary key.
The Customer_ID of Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claim_Headers is the foreign key of Policy_ID of Policies.
The Created_by_Staff_ID of Claims_Documents is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Documents is the foreign key of Claim_Header_ID of Claim_Headers.
The Staff_ID of Claims_Processing is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Processing is the foreign key of Claim_Header_ID of Claim_Headers.

##Role Access Policy (Column-Level):
Role: CustomerServiceAgent
Accessible Columns: Customers: Customer_ID, Customer_Details; Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claim_Headers: Claim_Header_ID, Claim_Status_Code, Policy_ID, Date_of_Claim; Staff: Staff_ID, Staff_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: Find all the policy type codes associated with the customer "Dayana Robel"
Answer: SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t2.customer_details  =  "Dayana Robel"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t2.customer_details  =  "Dayana Robel"
##Instruction:
Database: insurance_and_eClaims
Total Tables: 7
Total Columns: 30

Table Schemas:

insurance_and_eClaims contains tables such as Customers, Staff, Policies, Claim_Headers, Claims_Documents, Claims_Processing_Stages, Claims_Processing.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Staff has columns such as Staff_ID, Staff_Details.
Staff_ID is the primary key.
Table Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claim_Headers has columns such as Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim, Date_of_Settlement, Amount_Claimed, Amount_Piad.
Claim_Header_ID is the primary key.
Table Claims_Documents has columns such as Claim_ID, Document_Type_Code, Created_by_Staff_ID, Created_Date.
Claim_ID is the primary key.
Table Claims_Processing_Stages has columns such as Claim_Stage_ID, Next_Claim_Stage_ID, Claim_Status_Name, Claim_Status_Description.
Claim_Stage_ID is the primary key.
Table Claims_Processing has columns such as Claim_Processing_ID, Claim_ID, Claim_Outcome_Code, Claim_Stage_ID, Staff_ID.
Claim_Processing_ID is the primary key.
The Customer_ID of Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claim_Headers is the foreign key of Policy_ID of Policies.
The Created_by_Staff_ID of Claims_Documents is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Documents is the foreign key of Claim_Header_ID of Claim_Headers.
The Staff_ID of Claims_Processing is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Processing is the foreign key of Claim_Header_ID of Claim_Headers.

##Role Access Policy (Column-Level):
Role: CustomerServiceAgent
Accessible Columns: Customers: Customer_ID, Customer_Details; Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claim_Headers: Claim_Header_ID, Claim_Status_Code, Policy_ID, Date_of_Claim; Staff: Staff_ID, Staff_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 type codes of the policies used by the customer "Dayana Robel"?
Answer: SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t2.customer_details  =  "Dayana Robel"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id  =  t2.customer_id WHERE t2.customer_details  =  "Dayana Robel"
##Instruction:
Database: insurance_and_eClaims
Total Tables: 7
Total Columns: 30

Table Schemas:

insurance_and_eClaims contains tables such as Customers, Staff, Policies, Claim_Headers, Claims_Documents, Claims_Processing_Stages, Claims_Processing.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Staff has columns such as Staff_ID, Staff_Details.
Staff_ID is the primary key.
Table Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claim_Headers has columns such as Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim, Date_of_Settlement, Amount_Claimed, Amount_Piad.
Claim_Header_ID is the primary key.
Table Claims_Documents has columns such as Claim_ID, Document_Type_Code, Created_by_Staff_ID, Created_Date.
Claim_ID is the primary key.
Table Claims_Processing_Stages has columns such as Claim_Stage_ID, Next_Claim_Stage_ID, Claim_Status_Name, Claim_Status_Description.
Claim_Stage_ID is the primary key.
Table Claims_Processing has columns such as Claim_Processing_ID, Claim_ID, Claim_Outcome_Code, Claim_Stage_ID, Staff_ID.
Claim_Processing_ID is the primary key.
The Customer_ID of Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claim_Headers is the foreign key of Policy_ID of Policies.
The Created_by_Staff_ID of Claims_Documents is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Documents is the foreign key of Claim_Header_ID of Claim_Headers.
The Staff_ID of Claims_Processing is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Processing is the foreign key of Claim_Header_ID of Claim_Headers.

##Role Access Policy (Column-Level):
Role: CustomerServiceAgent
Accessible Columns: Customers: Customer_ID, Customer_Details; Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claim_Headers: Claim_Header_ID, Claim_Status_Code, Policy_ID, Date_of_Claim; Staff: Staff_ID, Staff_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: Which type of policy is most frequently used? Give me the policy type code.
Answer: SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
##Instruction:
Database: insurance_and_eClaims
Total Tables: 7
Total Columns: 30

Table Schemas:

insurance_and_eClaims contains tables such as Customers, Staff, Policies, Claim_Headers, Claims_Documents, Claims_Processing_Stages, Claims_Processing.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Staff has columns such as Staff_ID, Staff_Details.
Staff_ID is the primary key.
Table Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claim_Headers has columns such as Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim, Date_of_Settlement, Amount_Claimed, Amount_Piad.
Claim_Header_ID is the primary key.
Table Claims_Documents has columns such as Claim_ID, Document_Type_Code, Created_by_Staff_ID, Created_Date.
Claim_ID is the primary key.
Table Claims_Processing_Stages has columns such as Claim_Stage_ID, Next_Claim_Stage_ID, Claim_Status_Name, Claim_Status_Description.
Claim_Stage_ID is the primary key.
Table Claims_Processing has columns such as Claim_Processing_ID, Claim_ID, Claim_Outcome_Code, Claim_Stage_ID, Staff_ID.
Claim_Processing_ID is the primary key.
The Customer_ID of Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claim_Headers is the foreign key of Policy_ID of Policies.
The Created_by_Staff_ID of Claims_Documents is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Documents is the foreign key of Claim_Header_ID of Claim_Headers.
The Staff_ID of Claims_Processing is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Processing is the foreign key of Claim_Header_ID of Claim_Headers.

##Role Access Policy (Column-Level):
Role: CustomerServiceAgent
Accessible Columns: Customers: Customer_ID, Customer_Details; Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claim_Headers: Claim_Header_ID, Claim_Status_Code, Policy_ID, Date_of_Claim; Staff: Staff_ID, Staff_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: Find the type code of the most frequently used policy.
Answer: SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
##Instruction:
Database: insurance_and_eClaims
Total Tables: 7
Total Columns: 30

Table Schemas:

insurance_and_eClaims contains tables such as Customers, Staff, Policies, Claim_Headers, Claims_Documents, Claims_Processing_Stages, Claims_Processing.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Staff has columns such as Staff_ID, Staff_Details.
Staff_ID is the primary key.
Table Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claim_Headers has columns such as Claim_Header_ID, Claim_Status_Code, Claim_Type_Code, Policy_ID, Date_of_Claim, Date_of_Settlement, Amount_Claimed, Amount_Piad.
Claim_Header_ID is the primary key.
Table Claims_Documents has columns such as Claim_ID, Document_Type_Code, Created_by_Staff_ID, Created_Date.
Claim_ID is the primary key.
Table Claims_Processing_Stages has columns such as Claim_Stage_ID, Next_Claim_Stage_ID, Claim_Status_Name, Claim_Status_Description.
Claim_Stage_ID is the primary key.
Table Claims_Processing has columns such as Claim_Processing_ID, Claim_ID, Claim_Outcome_Code, Claim_Stage_ID, Staff_ID.
Claim_Processing_ID is the primary key.
The Customer_ID of Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claim_Headers is the foreign key of Policy_ID of Policies.
The Created_by_Staff_ID of Claims_Documents is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Documents is the foreign key of Claim_Header_ID of Claim_Headers.
The Staff_ID of Claims_Processing is the foreign key of Staff_ID of Staff.
The Claim_ID of Claims_Processing is the foreign key of Claim_Header_ID of Claim_Headers.

##Role Access Policy (Column-Level):
Role: CustomerServiceAgent
Accessible Columns: Customers: Customer_ID, Customer_Details; Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claim_Headers: Claim_Header_ID, Claim_Status_Code, Policy_ID, Date_of_Claim; Staff: Staff_ID, Staff_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: Find all the policy types that are used by more than 2 customers.
Answer: SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*)  >  2
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*)  >  2