sharkiefff/RBAC-Text2SQL-Benchmark huggingface dataset:
##Instruction:
Database: insurance_policies
Total Tables: 5
Total Columns: 25

Table Schemas:

insurance_policies contains tables such as Customers, Customer_Policies, Claims, Settlements, Payments.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Customer_Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claims has columns such as Claim_ID, Policy_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled.
Claim_ID is the primary key.
Table Settlements has columns such as Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled, Customer_Policy_ID.
Settlement_ID is the primary key.
Table Payments has columns such as Payment_ID, Settlement_ID, Payment_Method_Code, Date_Payment_Made, Amount_Payment.
Payment_ID is the primary key.
The Customer_ID of Customer_Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claims is the foreign key of Policy_ID of Customer_Policies.
The Claim_ID of Settlements is the foreign key of Claim_ID of Claims.
The Settlement_ID of Payments is the foreign key of Settlement_ID of Settlements.

##Role Access Policy (Column-Level):
Role: ClaimsAdjuster
Accessible Columns: Customers: Customer_ID, Customer_Details; Customer_Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claims: ALL COLUMNS; Settlements: Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled; Payments: Payment_ID, Settlement_ID, Date_Payment_Made

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 claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number.
Answer: SELECT T1.claim_id ,  T1.date_claim_made ,  count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY count(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.claim_id ,  T1.date_claim_made ,  count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY count(*) DESC LIMIT 1
##Instruction:
Database: insurance_policies
Total Tables: 5
Total Columns: 25

Table Schemas:

insurance_policies contains tables such as Customers, Customer_Policies, Claims, Settlements, Payments.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Customer_Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claims has columns such as Claim_ID, Policy_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled.
Claim_ID is the primary key.
Table Settlements has columns such as Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled, Customer_Policy_ID.
Settlement_ID is the primary key.
Table Payments has columns such as Payment_ID, Settlement_ID, Payment_Method_Code, Date_Payment_Made, Amount_Payment.
Payment_ID is the primary key.
The Customer_ID of Customer_Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claims is the foreign key of Policy_ID of Customer_Policies.
The Claim_ID of Settlements is the foreign key of Claim_ID of Claims.
The Settlement_ID of Payments is the foreign key of Settlement_ID of Settlements.

##Role Access Policy (Column-Level):
Role: ClaimsAdjuster
Accessible Columns: Customers: Customer_ID, Customer_Details; Customer_Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claims: ALL COLUMNS; Settlements: Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled; Payments: Payment_ID, Settlement_ID, Date_Payment_Made

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 claim id and claim date of the claim that incurred the most settlement count. Also tell me the count.
Answer: SELECT T1.claim_id ,  T1.date_claim_made ,  count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY count(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.claim_id ,  T1.date_claim_made ,  count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY count(*) DESC LIMIT 1
##Instruction:
Database: insurance_policies
Total Tables: 5
Total Columns: 25

Table Schemas:

insurance_policies contains tables such as Customers, Customer_Policies, Claims, Settlements, Payments.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Customer_Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claims has columns such as Claim_ID, Policy_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled.
Claim_ID is the primary key.
Table Settlements has columns such as Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled, Customer_Policy_ID.
Settlement_ID is the primary key.
Table Payments has columns such as Payment_ID, Settlement_ID, Payment_Method_Code, Date_Payment_Made, Amount_Payment.
Payment_ID is the primary key.
The Customer_ID of Customer_Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claims is the foreign key of Policy_ID of Customer_Policies.
The Claim_ID of Settlements is the foreign key of Claim_ID of Claims.
The Settlement_ID of Payments is the foreign key of Settlement_ID of Settlements.

##Role Access Policy (Column-Level):
Role: ClaimsAdjuster
Accessible Columns: Customers: Customer_ID, Customer_Details; Customer_Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claims: ALL COLUMNS; Settlements: Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled; Payments: Payment_ID, Settlement_ID, Date_Payment_Made

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 settlements were made on the claim with the most recent claim settlement date? List the number and the claim id.
Answer: SELECT count(*) ,  T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT count(*) ,  T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1
##Instruction:
Database: insurance_policies
Total Tables: 5
Total Columns: 25

Table Schemas:

insurance_policies contains tables such as Customers, Customer_Policies, Claims, Settlements, Payments.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Customer_Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claims has columns such as Claim_ID, Policy_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled.
Claim_ID is the primary key.
Table Settlements has columns such as Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled, Customer_Policy_ID.
Settlement_ID is the primary key.
Table Payments has columns such as Payment_ID, Settlement_ID, Payment_Method_Code, Date_Payment_Made, Amount_Payment.
Payment_ID is the primary key.
The Customer_ID of Customer_Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claims is the foreign key of Policy_ID of Customer_Policies.
The Claim_ID of Settlements is the foreign key of Claim_ID of Claims.
The Settlement_ID of Payments is the foreign key of Settlement_ID of Settlements.

##Role Access Policy (Column-Level):
Role: ClaimsAdjuster
Accessible Columns: Customers: Customer_ID, Customer_Details; Customer_Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claims: ALL COLUMNS; Settlements: Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled; Payments: Payment_ID, Settlement_ID, Date_Payment_Made

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 claim id and the number of settlements made for the claim with the most recent settlement date.
Answer: SELECT count(*) ,  T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT count(*) ,  T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id  =  T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1
##Instruction:
Database: insurance_policies
Total Tables: 5
Total Columns: 25

Table Schemas:

insurance_policies contains tables such as Customers, Customer_Policies, Claims, Settlements, Payments.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Customer_Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claims has columns such as Claim_ID, Policy_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled.
Claim_ID is the primary key.
Table Settlements has columns such as Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled, Customer_Policy_ID.
Settlement_ID is the primary key.
Table Payments has columns such as Payment_ID, Settlement_ID, Payment_Method_Code, Date_Payment_Made, Amount_Payment.
Payment_ID is the primary key.
The Customer_ID of Customer_Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claims is the foreign key of Policy_ID of Customer_Policies.
The Claim_ID of Settlements is the foreign key of Claim_ID of Claims.
The Settlement_ID of Payments is the foreign key of Settlement_ID of Settlements.

##Role Access Policy (Column-Level):
Role: ClaimsAdjuster
Accessible Columns: Customers: Customer_ID, Customer_Details; Customer_Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claims: ALL COLUMNS; Settlements: Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled; Payments: Payment_ID, Settlement_ID, Date_Payment_Made

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: Of all the claims, what was the earliest date when any claim was made?
Answer: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1
##Instruction:
Database: insurance_policies
Total Tables: 5
Total Columns: 25

Table Schemas:

insurance_policies contains tables such as Customers, Customer_Policies, Claims, Settlements, Payments.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Customer_Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claims has columns such as Claim_ID, Policy_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled.
Claim_ID is the primary key.
Table Settlements has columns such as Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled, Customer_Policy_ID.
Settlement_ID is the primary key.
Table Payments has columns such as Payment_ID, Settlement_ID, Payment_Method_Code, Date_Payment_Made, Amount_Payment.
Payment_ID is the primary key.
The Customer_ID of Customer_Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claims is the foreign key of Policy_ID of Customer_Policies.
The Claim_ID of Settlements is the foreign key of Claim_ID of Claims.
The Settlement_ID of Payments is the foreign key of Settlement_ID of Settlements.

##Role Access Policy (Column-Level):
Role: ClaimsAdjuster
Accessible Columns: Customers: Customer_ID, Customer_Details; Customer_Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claims: ALL COLUMNS; Settlements: Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled; Payments: Payment_ID, Settlement_ID, Date_Payment_Made

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: Tell me the the date when the first claim was made.
Answer: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1
##Instruction:
Database: insurance_policies
Total Tables: 5
Total Columns: 25

Table Schemas:

insurance_policies contains tables such as Customers, Customer_Policies, Claims, Settlements, Payments.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Customer_Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claims has columns such as Claim_ID, Policy_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled.
Claim_ID is the primary key.
Table Settlements has columns such as Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled, Customer_Policy_ID.
Settlement_ID is the primary key.
Table Payments has columns such as Payment_ID, Settlement_ID, Payment_Method_Code, Date_Payment_Made, Amount_Payment.
Payment_ID is the primary key.
The Customer_ID of Customer_Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claims is the foreign key of Policy_ID of Customer_Policies.
The Claim_ID of Settlements is the foreign key of Claim_ID of Claims.
The Settlement_ID of Payments is the foreign key of Settlement_ID of Settlements.

##Role Access Policy (Column-Level):
Role: ClaimsAdjuster
Accessible Columns: Customers: Customer_ID, Customer_Details; Customer_Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claims: ALL COLUMNS; Settlements: Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled; Payments: Payment_ID, Settlement_ID, Date_Payment_Made

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 total amount of settlement made for all the settlements?
Answer: SELECT sum(Amount_Settled) FROM Settlements
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT sum(Amount_Settled) FROM Settlements
##Instruction:
Database: insurance_policies
Total Tables: 5
Total Columns: 25

Table Schemas:

insurance_policies contains tables such as Customers, Customer_Policies, Claims, Settlements, Payments.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Customer_Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claims has columns such as Claim_ID, Policy_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled.
Claim_ID is the primary key.
Table Settlements has columns such as Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled, Customer_Policy_ID.
Settlement_ID is the primary key.
Table Payments has columns such as Payment_ID, Settlement_ID, Payment_Method_Code, Date_Payment_Made, Amount_Payment.
Payment_ID is the primary key.
The Customer_ID of Customer_Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claims is the foreign key of Policy_ID of Customer_Policies.
The Claim_ID of Settlements is the foreign key of Claim_ID of Claims.
The Settlement_ID of Payments is the foreign key of Settlement_ID of Settlements.

##Role Access Policy (Column-Level):
Role: ClaimsAdjuster
Accessible Columns: Customers: Customer_ID, Customer_Details; Customer_Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claims: ALL COLUMNS; Settlements: Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled; Payments: Payment_ID, Settlement_ID, Date_Payment_Made

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: Compute the total amount of settlement across all the settlements.
Answer: SELECT sum(Amount_Settled) FROM Settlements
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT sum(Amount_Settled) FROM Settlements
##Instruction:
Database: insurance_policies
Total Tables: 5
Total Columns: 25

Table Schemas:

insurance_policies contains tables such as Customers, Customer_Policies, Claims, Settlements, Payments.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Customer_Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claims has columns such as Claim_ID, Policy_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled.
Claim_ID is the primary key.
Table Settlements has columns such as Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled, Customer_Policy_ID.
Settlement_ID is the primary key.
Table Payments has columns such as Payment_ID, Settlement_ID, Payment_Method_Code, Date_Payment_Made, Amount_Payment.
Payment_ID is the primary key.
The Customer_ID of Customer_Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claims is the foreign key of Policy_ID of Customer_Policies.
The Claim_ID of Settlements is the foreign key of Claim_ID of Claims.
The Settlement_ID of Payments is the foreign key of Settlement_ID of Settlements.

##Role Access Policy (Column-Level):
Role: ClaimsAdjuster
Accessible Columns: Customers: Customer_ID, Customer_Details; Customer_Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claims: ALL COLUMNS; Settlements: Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled; Payments: Payment_ID, Settlement_ID, Date_Payment_Made

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: Who are the customers that had more than 1 policy? List the customer details and id.
Answer: SELECT T1.customer_details ,  T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id  =  T2.Customer_id GROUP BY T1.customer_id HAVING count(*)  >  1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.customer_details ,  T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id  =  T2.Customer_id GROUP BY T1.customer_id HAVING count(*)  >  1
##Instruction:
Database: insurance_policies
Total Tables: 5
Total Columns: 25

Table Schemas:

insurance_policies contains tables such as Customers, Customer_Policies, Claims, Settlements, Payments.
Table Customers has columns such as Customer_ID, Customer_Details.
Customer_ID is the primary key.
Table Customer_Policies has columns such as Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date.
Policy_ID is the primary key.
Table Claims has columns such as Claim_ID, Policy_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled.
Claim_ID is the primary key.
Table Settlements has columns such as Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled, Customer_Policy_ID.
Settlement_ID is the primary key.
Table Payments has columns such as Payment_ID, Settlement_ID, Payment_Method_Code, Date_Payment_Made, Amount_Payment.
Payment_ID is the primary key.
The Customer_ID of Customer_Policies is the foreign key of Customer_ID of Customers.
The Policy_ID of Claims is the foreign key of Policy_ID of Customer_Policies.
The Claim_ID of Settlements is the foreign key of Claim_ID of Claims.
The Settlement_ID of Payments is the foreign key of Settlement_ID of Settlements.

##Role Access Policy (Column-Level):
Role: ClaimsAdjuster
Accessible Columns: Customers: Customer_ID, Customer_Details; Customer_Policies: Policy_ID, Customer_ID, Policy_Type_Code, Start_Date, End_Date; Claims: ALL COLUMNS; Settlements: Settlement_ID, Claim_ID, Date_Claim_Made, Date_Claim_Settled, Amount_Claimed, Amount_Settled; Payments: Payment_ID, Settlement_ID, Date_Payment_Made

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 the customer details and id for the customers who had more than one policy.
Answer: SELECT T1.customer_details ,  T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id  =  T2.Customer_id GROUP BY T1.customer_id HAVING count(*)  >  1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.customer_details ,  T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_id  =  T2.Customer_id GROUP BY T1.customer_id HAVING count(*)  >  1