sharkiefff/RBAC-Text2SQL-Benchmark huggingface dataset:
##Instruction:
Database: dog_kennels
Total Tables: 8
Total Columns: 49

Table Schemas:

dog_kennels contains tables such as Breeds, Charges, Sizes, Treatment_Types, Owners, Dogs, Professionals, Treatments.
Table Breeds has columns such as breed_code, breed_name.
breed_code is the primary key.
Table Charges has columns such as charge_id, charge_type, charge_amount.
charge_id is the primary key.
Table Sizes has columns such as size_code, size_description.
size_code is the primary key.
Table Treatment_Types has columns such as treatment_type_code, treatment_type_description.
treatment_type_code is the primary key.
Table Owners has columns such as owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number.
owner_id is the primary key.
Table Dogs has columns such as dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed.
dog_id is the primary key.
Table Professionals has columns such as professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number.
professional_id is the primary key.
Table Treatments has columns such as treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment.
treatment_id is the primary key.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The size_code of Dogs is the foreign key of size_code of Sizes.
The breed_code of Dogs is the foreign key of breed_code of Breeds.
The dog_id of Treatments is the foreign key of dog_id of Dogs.
The professional_id of Treatments is the foreign key of professional_id of Professionals.
The treatment_type_code of Treatments is the foreign key of treatment_type_code of Treatment_Types.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns: Breeds: breed_name; Charges: charge_id, charge_type; Dogs: ALL COLUMNS; Owners: ALL COLUMNS; Professionals: cell_number, city, email_address, first_name, last_name, professional_id, role_code, state, street; Sizes: ALL COLUMNS; Treatment_Types: treatment_type_code; Treatments: cost_of_treatment, date_of_treatment, dog_id, professional_id, treatment_type_code

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 dogs that went through a treatment.
Answer: SELECT count(DISTINCT dog_id) FROM Treatments
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT count(DISTINCT dog_id) FROM Treatments
##Instruction:
Database: dog_kennels
Total Tables: 8
Total Columns: 49

Table Schemas:

dog_kennels contains tables such as Breeds, Charges, Sizes, Treatment_Types, Owners, Dogs, Professionals, Treatments.
Table Breeds has columns such as breed_code, breed_name.
breed_code is the primary key.
Table Charges has columns such as charge_id, charge_type, charge_amount.
charge_id is the primary key.
Table Sizes has columns such as size_code, size_description.
size_code is the primary key.
Table Treatment_Types has columns such as treatment_type_code, treatment_type_description.
treatment_type_code is the primary key.
Table Owners has columns such as owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number.
owner_id is the primary key.
Table Dogs has columns such as dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed.
dog_id is the primary key.
Table Professionals has columns such as professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number.
professional_id is the primary key.
Table Treatments has columns such as treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment.
treatment_id is the primary key.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The size_code of Dogs is the foreign key of size_code of Sizes.
The breed_code of Dogs is the foreign key of breed_code of Breeds.
The dog_id of Treatments is the foreign key of dog_id of Dogs.
The professional_id of Treatments is the foreign key of professional_id of Professionals.
The treatment_type_code of Treatments is the foreign key of treatment_type_code of Treatment_Types.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns: Breeds: breed_name; Charges: charge_id, charge_type; Dogs: ALL COLUMNS; Owners: ALL COLUMNS; Professionals: cell_number, city, email_address, first_name, last_name, professional_id, role_code, state, street; Sizes: ALL COLUMNS; Treatment_Types: treatment_type_code; Treatments: cost_of_treatment, date_of_treatment, dog_id, professional_id, treatment_type_code

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 professionals have performed any treatment to dogs?
Answer: SELECT count(DISTINCT professional_id) FROM Treatments
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT count(DISTINCT professional_id) FROM Treatments
##Instruction:
Database: dog_kennels
Total Tables: 8
Total Columns: 49

Table Schemas:

dog_kennels contains tables such as Breeds, Charges, Sizes, Treatment_Types, Owners, Dogs, Professionals, Treatments.
Table Breeds has columns such as breed_code, breed_name.
breed_code is the primary key.
Table Charges has columns such as charge_id, charge_type, charge_amount.
charge_id is the primary key.
Table Sizes has columns such as size_code, size_description.
size_code is the primary key.
Table Treatment_Types has columns such as treatment_type_code, treatment_type_description.
treatment_type_code is the primary key.
Table Owners has columns such as owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number.
owner_id is the primary key.
Table Dogs has columns such as dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed.
dog_id is the primary key.
Table Professionals has columns such as professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number.
professional_id is the primary key.
Table Treatments has columns such as treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment.
treatment_id is the primary key.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The size_code of Dogs is the foreign key of size_code of Sizes.
The breed_code of Dogs is the foreign key of breed_code of Breeds.
The dog_id of Treatments is the foreign key of dog_id of Dogs.
The professional_id of Treatments is the foreign key of professional_id of Professionals.
The treatment_type_code of Treatments is the foreign key of treatment_type_code of Treatment_Types.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns: Breeds: breed_name; Charges: charge_id, charge_type; Dogs: ALL COLUMNS; Owners: ALL COLUMNS; Professionals: cell_number, city, email_address, first_name, last_name, professional_id, role_code, state, street; Sizes: ALL COLUMNS; Treatment_Types: treatment_type_code; Treatments: cost_of_treatment, date_of_treatment, dog_id, professional_id, treatment_type_code

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 number of professionals who have ever treated dogs.
Answer: SELECT count(DISTINCT professional_id) FROM Treatments
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT count(DISTINCT professional_id) FROM Treatments
##Instruction:
Database: dog_kennels
Total Tables: 8
Total Columns: 49

Table Schemas:

dog_kennels contains tables such as Breeds, Charges, Sizes, Treatment_Types, Owners, Dogs, Professionals, Treatments.
Table Breeds has columns such as breed_code, breed_name.
breed_code is the primary key.
Table Charges has columns such as charge_id, charge_type, charge_amount.
charge_id is the primary key.
Table Sizes has columns such as size_code, size_description.
size_code is the primary key.
Table Treatment_Types has columns such as treatment_type_code, treatment_type_description.
treatment_type_code is the primary key.
Table Owners has columns such as owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number.
owner_id is the primary key.
Table Dogs has columns such as dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed.
dog_id is the primary key.
Table Professionals has columns such as professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number.
professional_id is the primary key.
Table Treatments has columns such as treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment.
treatment_id is the primary key.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The size_code of Dogs is the foreign key of size_code of Sizes.
The breed_code of Dogs is the foreign key of breed_code of Breeds.
The dog_id of Treatments is the foreign key of dog_id of Dogs.
The professional_id of Treatments is the foreign key of professional_id of Professionals.
The treatment_type_code of Treatments is the foreign key of treatment_type_code of Treatment_Types.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns: Breeds: breed_name; Charges: charge_id, charge_type; Dogs: ALL COLUMNS; Owners: ALL COLUMNS; Professionals: cell_number, city, email_address, first_name, last_name, professional_id, role_code, state, street; Sizes: ALL COLUMNS; Treatment_Types: treatment_type_code; Treatments: cost_of_treatment, date_of_treatment, dog_id, professional_id, treatment_type_code

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 professionals live in a city containing the substring 'West'? List his or her role, street, city and state.
Answer: SELECT role_code ,  street ,  city ,  state FROM professionals WHERE city LIKE '%West%'
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT role_code ,  street ,  city ,  state FROM professionals WHERE city LIKE '%West%'
##Instruction:
Database: dog_kennels
Total Tables: 8
Total Columns: 49

Table Schemas:

dog_kennels contains tables such as Breeds, Charges, Sizes, Treatment_Types, Owners, Dogs, Professionals, Treatments.
Table Breeds has columns such as breed_code, breed_name.
breed_code is the primary key.
Table Charges has columns such as charge_id, charge_type, charge_amount.
charge_id is the primary key.
Table Sizes has columns such as size_code, size_description.
size_code is the primary key.
Table Treatment_Types has columns such as treatment_type_code, treatment_type_description.
treatment_type_code is the primary key.
Table Owners has columns such as owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number.
owner_id is the primary key.
Table Dogs has columns such as dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed.
dog_id is the primary key.
Table Professionals has columns such as professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number.
professional_id is the primary key.
Table Treatments has columns such as treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment.
treatment_id is the primary key.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The size_code of Dogs is the foreign key of size_code of Sizes.
The breed_code of Dogs is the foreign key of breed_code of Breeds.
The dog_id of Treatments is the foreign key of dog_id of Dogs.
The professional_id of Treatments is the foreign key of professional_id of Professionals.
The treatment_type_code of Treatments is the foreign key of treatment_type_code of Treatment_Types.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns: Breeds: breed_name; Charges: charge_id, charge_type; Dogs: ALL COLUMNS; Owners: ALL COLUMNS; Professionals: cell_number, city, email_address, first_name, last_name, professional_id, role_code, state, street; Sizes: ALL COLUMNS; Treatment_Types: treatment_type_code; Treatments: cost_of_treatment, date_of_treatment, dog_id, professional_id, treatment_type_code

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 role, street, city and state of the professionals living in a city that contains the substring 'West'.
Answer: SELECT role_code ,  street ,  city ,  state FROM professionals WHERE city LIKE '%West%'
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT role_code ,  street ,  city ,  state FROM professionals WHERE city LIKE '%West%'
##Instruction:
Database: dog_kennels
Total Tables: 8
Total Columns: 49

Table Schemas:

dog_kennels contains tables such as Breeds, Charges, Sizes, Treatment_Types, Owners, Dogs, Professionals, Treatments.
Table Breeds has columns such as breed_code, breed_name.
breed_code is the primary key.
Table Charges has columns such as charge_id, charge_type, charge_amount.
charge_id is the primary key.
Table Sizes has columns such as size_code, size_description.
size_code is the primary key.
Table Treatment_Types has columns such as treatment_type_code, treatment_type_description.
treatment_type_code is the primary key.
Table Owners has columns such as owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number.
owner_id is the primary key.
Table Dogs has columns such as dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed.
dog_id is the primary key.
Table Professionals has columns such as professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number.
professional_id is the primary key.
Table Treatments has columns such as treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment.
treatment_id is the primary key.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The size_code of Dogs is the foreign key of size_code of Sizes.
The breed_code of Dogs is the foreign key of breed_code of Breeds.
The dog_id of Treatments is the foreign key of dog_id of Dogs.
The professional_id of Treatments is the foreign key of professional_id of Professionals.
The treatment_type_code of Treatments is the foreign key of treatment_type_code of Treatment_Types.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns: Breeds: breed_name; Charges: charge_id, charge_type; Dogs: ALL COLUMNS; Owners: ALL COLUMNS; Professionals: cell_number, city, email_address, first_name, last_name, professional_id, role_code, state, street; Sizes: ALL COLUMNS; Treatment_Types: treatment_type_code; Treatments: cost_of_treatment, date_of_treatment, dog_id, professional_id, treatment_type_code

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 owners live in the state whose name contains the substring 'North'? List his first name, last name and email.
Answer: SELECT first_name ,  last_name ,  email_address FROM Owners WHERE state LIKE '%North%'
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT first_name ,  last_name ,  email_address FROM Owners WHERE state LIKE '%North%'
##Instruction:
Database: dog_kennels
Total Tables: 8
Total Columns: 49

Table Schemas:

dog_kennels contains tables such as Breeds, Charges, Sizes, Treatment_Types, Owners, Dogs, Professionals, Treatments.
Table Breeds has columns such as breed_code, breed_name.
breed_code is the primary key.
Table Charges has columns such as charge_id, charge_type, charge_amount.
charge_id is the primary key.
Table Sizes has columns such as size_code, size_description.
size_code is the primary key.
Table Treatment_Types has columns such as treatment_type_code, treatment_type_description.
treatment_type_code is the primary key.
Table Owners has columns such as owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number.
owner_id is the primary key.
Table Dogs has columns such as dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed.
dog_id is the primary key.
Table Professionals has columns such as professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number.
professional_id is the primary key.
Table Treatments has columns such as treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment.
treatment_id is the primary key.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The size_code of Dogs is the foreign key of size_code of Sizes.
The breed_code of Dogs is the foreign key of breed_code of Breeds.
The dog_id of Treatments is the foreign key of dog_id of Dogs.
The professional_id of Treatments is the foreign key of professional_id of Professionals.
The treatment_type_code of Treatments is the foreign key of treatment_type_code of Treatment_Types.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns: Breeds: breed_name; Charges: charge_id, charge_type; Dogs: ALL COLUMNS; Owners: ALL COLUMNS; Professionals: cell_number, city, email_address, first_name, last_name, professional_id, role_code, state, street; Sizes: ALL COLUMNS; Treatment_Types: treatment_type_code; Treatments: cost_of_treatment, date_of_treatment, dog_id, professional_id, treatment_type_code

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 first name, last name and email of the owners living in a state whose name contains the substring 'North'.
Answer: SELECT first_name ,  last_name ,  email_address FROM Owners WHERE state LIKE '%North%'
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT first_name ,  last_name ,  email_address FROM Owners WHERE state LIKE '%North%'
##Instruction:
Database: dog_kennels
Total Tables: 8
Total Columns: 49

Table Schemas:

dog_kennels contains tables such as Breeds, Charges, Sizes, Treatment_Types, Owners, Dogs, Professionals, Treatments.
Table Breeds has columns such as breed_code, breed_name.
breed_code is the primary key.
Table Charges has columns such as charge_id, charge_type, charge_amount.
charge_id is the primary key.
Table Sizes has columns such as size_code, size_description.
size_code is the primary key.
Table Treatment_Types has columns such as treatment_type_code, treatment_type_description.
treatment_type_code is the primary key.
Table Owners has columns such as owner_id, first_name, last_name, street, city, state, zip_code, email_address, home_phone, cell_number.
owner_id is the primary key.
Table Dogs has columns such as dog_id, owner_id, abandoned_yn, breed_code, size_code, name, age, date_of_birth, gender, weight, date_arrived, date_adopted, date_departed.
dog_id is the primary key.
Table Professionals has columns such as professional_id, role_code, first_name, street, city, state, zip_code, last_name, email_address, home_phone, cell_number.
professional_id is the primary key.
Table Treatments has columns such as treatment_id, dog_id, professional_id, treatment_type_code, date_of_treatment, cost_of_treatment.
treatment_id is the primary key.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The owner_id of Dogs is the foreign key of owner_id of Owners.
The size_code of Dogs is the foreign key of size_code of Sizes.
The breed_code of Dogs is the foreign key of breed_code of Breeds.
The dog_id of Treatments is the foreign key of dog_id of Dogs.
The professional_id of Treatments is the foreign key of professional_id of Professionals.
The treatment_type_code of Treatments is the foreign key of treatment_type_code of Treatment_Types.

##Role Access Policy (Column-Level):
Role: DataOperator_1
Accessible Columns: Breeds: breed_name; Charges: charge_id, charge_type; Dogs: ALL COLUMNS; Owners: ALL COLUMNS; Professionals: cell_number, city, email_address, first_name, last_name, professional_id, role_code, state, street; Sizes: ALL COLUMNS; Treatment_Types: treatment_type_code; Treatments: cost_of_treatment, date_of_treatment, dog_id, professional_id, treatment_type_code

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 dogs have an age below the average?
Answer: SELECT count(*) FROM Dogs WHERE age  <  ( SELECT avg(age) FROM Dogs )
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT count(*) FROM Dogs WHERE age  <  ( SELECT avg(age) FROM Dogs )