sharkiefff/RBAC-Text2SQL-Benchmark huggingface dataset:
##Instruction:
Database: apartment_rentals
Total Tables: 6
Total Columns: 31

Table Schemas:

apartment_rentals contains tables such as Apartment_Buildings, Apartments, Apartment_Facilities, Guests, Apartment_Bookings, View_Unit_Status.
Table Apartment_Buildings has columns such as building_id, building_short_name, building_full_name, building_description, building_address, building_manager, building_phone.
building_id is the primary key.
Table Apartments has columns such as apt_id, building_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count.
apt_id is the primary key.
Table Apartment_Facilities has columns such as apt_id, facility_code.
apt_id is the primary key.
Table Guests has columns such as guest_id, gender_code, guest_first_name, guest_last_name, date_of_birth.
guest_id is the primary key.
Table Apartment_Bookings has columns such as apt_booking_id, apt_id, guest_id, booking_status_code, booking_start_date, booking_end_date.
apt_booking_id is the primary key.
Table View_Unit_Status has columns such as apt_id, apt_booking_id, status_date, available_yn.
status_date is the primary key.
The building_id of Apartments is the foreign key of building_id of Apartment_Buildings.
The apt_id of Apartment_Facilities is the foreign key of apt_id of Apartments.
The guest_id of Apartment_Bookings is the foreign key of guest_id of Guests.
The apt_id of Apartment_Bookings is the foreign key of apt_id of Apartments.
The apt_booking_id of View_Unit_Status is the foreign key of apt_booking_id of Apartment_Bookings.
The apt_id of View_Unit_Status is the foreign key of apt_id of Apartments.

##Role Access Policy (Column-Level):
Role: ReservationAgent
Accessible Columns: Apartments: apt_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count; Guests: guest_id, guest_first_name, guest_last_name; Apartment_Bookings: ALL COLUMNS; View_Unit_Status: apt_id, status_date, available_yn

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 most common apartment type code.
Answer: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
##Instruction:
Database: apartment_rentals
Total Tables: 6
Total Columns: 31

Table Schemas:

apartment_rentals contains tables such as Apartment_Buildings, Apartments, Apartment_Facilities, Guests, Apartment_Bookings, View_Unit_Status.
Table Apartment_Buildings has columns such as building_id, building_short_name, building_full_name, building_description, building_address, building_manager, building_phone.
building_id is the primary key.
Table Apartments has columns such as apt_id, building_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count.
apt_id is the primary key.
Table Apartment_Facilities has columns such as apt_id, facility_code.
apt_id is the primary key.
Table Guests has columns such as guest_id, gender_code, guest_first_name, guest_last_name, date_of_birth.
guest_id is the primary key.
Table Apartment_Bookings has columns such as apt_booking_id, apt_id, guest_id, booking_status_code, booking_start_date, booking_end_date.
apt_booking_id is the primary key.
Table View_Unit_Status has columns such as apt_id, apt_booking_id, status_date, available_yn.
status_date is the primary key.
The building_id of Apartments is the foreign key of building_id of Apartment_Buildings.
The apt_id of Apartment_Facilities is the foreign key of apt_id of Apartments.
The guest_id of Apartment_Bookings is the foreign key of guest_id of Guests.
The apt_id of Apartment_Bookings is the foreign key of apt_id of Apartments.
The apt_booking_id of View_Unit_Status is the foreign key of apt_booking_id of Apartment_Bookings.
The apt_id of View_Unit_Status is the foreign key of apt_id of Apartments.

##Role Access Policy (Column-Level):
Role: ReservationAgent
Accessible Columns: Apartments: apt_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count; Guests: guest_id, guest_first_name, guest_last_name; Apartment_Bookings: ALL COLUMNS; View_Unit_Status: apt_id, status_date, available_yn

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 apartment type code appears the most often?
Answer: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
##Instruction:
Database: apartment_rentals
Total Tables: 6
Total Columns: 31

Table Schemas:

apartment_rentals contains tables such as Apartment_Buildings, Apartments, Apartment_Facilities, Guests, Apartment_Bookings, View_Unit_Status.
Table Apartment_Buildings has columns such as building_id, building_short_name, building_full_name, building_description, building_address, building_manager, building_phone.
building_id is the primary key.
Table Apartments has columns such as apt_id, building_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count.
apt_id is the primary key.
Table Apartment_Facilities has columns such as apt_id, facility_code.
apt_id is the primary key.
Table Guests has columns such as guest_id, gender_code, guest_first_name, guest_last_name, date_of_birth.
guest_id is the primary key.
Table Apartment_Bookings has columns such as apt_booking_id, apt_id, guest_id, booking_status_code, booking_start_date, booking_end_date.
apt_booking_id is the primary key.
Table View_Unit_Status has columns such as apt_id, apt_booking_id, status_date, available_yn.
status_date is the primary key.
The building_id of Apartments is the foreign key of building_id of Apartment_Buildings.
The apt_id of Apartment_Facilities is the foreign key of apt_id of Apartments.
The guest_id of Apartment_Bookings is the foreign key of guest_id of Guests.
The apt_id of Apartment_Bookings is the foreign key of apt_id of Apartments.
The apt_booking_id of View_Unit_Status is the foreign key of apt_booking_id of Apartment_Bookings.
The apt_id of View_Unit_Status is the foreign key of apt_id of Apartments.

##Role Access Policy (Column-Level):
Role: ReservationAgent
Accessible Columns: Apartments: apt_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count; Guests: guest_id, guest_first_name, guest_last_name; Apartment_Bookings: ALL COLUMNS; View_Unit_Status: apt_id, status_date, available_yn

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 most common apartment type code among apartments with more than 1 bathroom.
Answer: SELECT apt_type_code FROM Apartments WHERE bathroom_count  >  1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT apt_type_code FROM Apartments WHERE bathroom_count  >  1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
##Instruction:
Database: apartment_rentals
Total Tables: 6
Total Columns: 31

Table Schemas:

apartment_rentals contains tables such as Apartment_Buildings, Apartments, Apartment_Facilities, Guests, Apartment_Bookings, View_Unit_Status.
Table Apartment_Buildings has columns such as building_id, building_short_name, building_full_name, building_description, building_address, building_manager, building_phone.
building_id is the primary key.
Table Apartments has columns such as apt_id, building_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count.
apt_id is the primary key.
Table Apartment_Facilities has columns such as apt_id, facility_code.
apt_id is the primary key.
Table Guests has columns such as guest_id, gender_code, guest_first_name, guest_last_name, date_of_birth.
guest_id is the primary key.
Table Apartment_Bookings has columns such as apt_booking_id, apt_id, guest_id, booking_status_code, booking_start_date, booking_end_date.
apt_booking_id is the primary key.
Table View_Unit_Status has columns such as apt_id, apt_booking_id, status_date, available_yn.
status_date is the primary key.
The building_id of Apartments is the foreign key of building_id of Apartment_Buildings.
The apt_id of Apartment_Facilities is the foreign key of apt_id of Apartments.
The guest_id of Apartment_Bookings is the foreign key of guest_id of Guests.
The apt_id of Apartment_Bookings is the foreign key of apt_id of Apartments.
The apt_booking_id of View_Unit_Status is the foreign key of apt_booking_id of Apartment_Bookings.
The apt_id of View_Unit_Status is the foreign key of apt_id of Apartments.

##Role Access Policy (Column-Level):
Role: ReservationAgent
Accessible Columns: Apartments: apt_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count; Guests: guest_id, guest_first_name, guest_last_name; Apartment_Bookings: ALL COLUMNS; View_Unit_Status: apt_id, status_date, available_yn

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 apartment type code is the most common among apartments with more than one bathroom?
Answer: SELECT apt_type_code FROM Apartments WHERE bathroom_count  >  1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT apt_type_code FROM Apartments WHERE bathroom_count  >  1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
##Instruction:
Database: apartment_rentals
Total Tables: 6
Total Columns: 31

Table Schemas:

apartment_rentals contains tables such as Apartment_Buildings, Apartments, Apartment_Facilities, Guests, Apartment_Bookings, View_Unit_Status.
Table Apartment_Buildings has columns such as building_id, building_short_name, building_full_name, building_description, building_address, building_manager, building_phone.
building_id is the primary key.
Table Apartments has columns such as apt_id, building_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count.
apt_id is the primary key.
Table Apartment_Facilities has columns such as apt_id, facility_code.
apt_id is the primary key.
Table Guests has columns such as guest_id, gender_code, guest_first_name, guest_last_name, date_of_birth.
guest_id is the primary key.
Table Apartment_Bookings has columns such as apt_booking_id, apt_id, guest_id, booking_status_code, booking_start_date, booking_end_date.
apt_booking_id is the primary key.
Table View_Unit_Status has columns such as apt_id, apt_booking_id, status_date, available_yn.
status_date is the primary key.
The building_id of Apartments is the foreign key of building_id of Apartment_Buildings.
The apt_id of Apartment_Facilities is the foreign key of apt_id of Apartments.
The guest_id of Apartment_Bookings is the foreign key of guest_id of Guests.
The apt_id of Apartment_Bookings is the foreign key of apt_id of Apartments.
The apt_booking_id of View_Unit_Status is the foreign key of apt_booking_id of Apartment_Bookings.
The apt_id of View_Unit_Status is the foreign key of apt_id of Apartments.

##Role Access Policy (Column-Level):
Role: ReservationAgent
Accessible Columns: Apartments: apt_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count; Guests: guest_id, guest_first_name, guest_last_name; Apartment_Bookings: ALL COLUMNS; View_Unit_Status: apt_id, status_date, available_yn

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 each apartment type code, and the maximum and minimum number of rooms for each type.
Answer: SELECT apt_type_code ,  max(room_count) ,  min(room_count) FROM Apartments GROUP BY apt_type_code
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT apt_type_code ,  max(room_count) ,  min(room_count) FROM Apartments GROUP BY apt_type_code
##Instruction:
Database: apartment_rentals
Total Tables: 6
Total Columns: 31

Table Schemas:

apartment_rentals contains tables such as Apartment_Buildings, Apartments, Apartment_Facilities, Guests, Apartment_Bookings, View_Unit_Status.
Table Apartment_Buildings has columns such as building_id, building_short_name, building_full_name, building_description, building_address, building_manager, building_phone.
building_id is the primary key.
Table Apartments has columns such as apt_id, building_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count.
apt_id is the primary key.
Table Apartment_Facilities has columns such as apt_id, facility_code.
apt_id is the primary key.
Table Guests has columns such as guest_id, gender_code, guest_first_name, guest_last_name, date_of_birth.
guest_id is the primary key.
Table Apartment_Bookings has columns such as apt_booking_id, apt_id, guest_id, booking_status_code, booking_start_date, booking_end_date.
apt_booking_id is the primary key.
Table View_Unit_Status has columns such as apt_id, apt_booking_id, status_date, available_yn.
status_date is the primary key.
The building_id of Apartments is the foreign key of building_id of Apartment_Buildings.
The apt_id of Apartment_Facilities is the foreign key of apt_id of Apartments.
The guest_id of Apartment_Bookings is the foreign key of guest_id of Guests.
The apt_id of Apartment_Bookings is the foreign key of apt_id of Apartments.
The apt_booking_id of View_Unit_Status is the foreign key of apt_booking_id of Apartment_Bookings.
The apt_id of View_Unit_Status is the foreign key of apt_id of Apartments.

##Role Access Policy (Column-Level):
Role: ReservationAgent
Accessible Columns: Apartments: apt_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count; Guests: guest_id, guest_first_name, guest_last_name; Apartment_Bookings: ALL COLUMNS; View_Unit_Status: apt_id, status_date, available_yn

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 each apartment type code along with the maximum and minimum number of rooms among each type.
Answer: SELECT apt_type_code ,  max(room_count) ,  min(room_count) FROM Apartments GROUP BY apt_type_code
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT apt_type_code ,  max(room_count) ,  min(room_count) FROM Apartments GROUP BY apt_type_code
##Instruction:
Database: apartment_rentals
Total Tables: 6
Total Columns: 31

Table Schemas:

apartment_rentals contains tables such as Apartment_Buildings, Apartments, Apartment_Facilities, Guests, Apartment_Bookings, View_Unit_Status.
Table Apartment_Buildings has columns such as building_id, building_short_name, building_full_name, building_description, building_address, building_manager, building_phone.
building_id is the primary key.
Table Apartments has columns such as apt_id, building_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count.
apt_id is the primary key.
Table Apartment_Facilities has columns such as apt_id, facility_code.
apt_id is the primary key.
Table Guests has columns such as guest_id, gender_code, guest_first_name, guest_last_name, date_of_birth.
guest_id is the primary key.
Table Apartment_Bookings has columns such as apt_booking_id, apt_id, guest_id, booking_status_code, booking_start_date, booking_end_date.
apt_booking_id is the primary key.
Table View_Unit_Status has columns such as apt_id, apt_booking_id, status_date, available_yn.
status_date is the primary key.
The building_id of Apartments is the foreign key of building_id of Apartment_Buildings.
The apt_id of Apartment_Facilities is the foreign key of apt_id of Apartments.
The guest_id of Apartment_Bookings is the foreign key of guest_id of Guests.
The apt_id of Apartment_Bookings is the foreign key of apt_id of Apartments.
The apt_booking_id of View_Unit_Status is the foreign key of apt_booking_id of Apartment_Bookings.
The apt_id of View_Unit_Status is the foreign key of apt_id of Apartments.

##Role Access Policy (Column-Level):
Role: ReservationAgent
Accessible Columns: Apartments: apt_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count; Guests: guest_id, guest_first_name, guest_last_name; Apartment_Bookings: ALL COLUMNS; View_Unit_Status: apt_id, status_date, available_yn

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 each gender code and the corresponding count of guests sorted by the count in descending order.
Answer: Sorry, I cannot answer.
Permission: denied (Missing column permissions: guests: gender_code)
Gold SQL: SELECT gender_code ,  COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC
##Instruction:
Database: apartment_rentals
Total Tables: 6
Total Columns: 31

Table Schemas:

apartment_rentals contains tables such as Apartment_Buildings, Apartments, Apartment_Facilities, Guests, Apartment_Bookings, View_Unit_Status.
Table Apartment_Buildings has columns such as building_id, building_short_name, building_full_name, building_description, building_address, building_manager, building_phone.
building_id is the primary key.
Table Apartments has columns such as apt_id, building_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count.
apt_id is the primary key.
Table Apartment_Facilities has columns such as apt_id, facility_code.
apt_id is the primary key.
Table Guests has columns such as guest_id, gender_code, guest_first_name, guest_last_name, date_of_birth.
guest_id is the primary key.
Table Apartment_Bookings has columns such as apt_booking_id, apt_id, guest_id, booking_status_code, booking_start_date, booking_end_date.
apt_booking_id is the primary key.
Table View_Unit_Status has columns such as apt_id, apt_booking_id, status_date, available_yn.
status_date is the primary key.
The building_id of Apartments is the foreign key of building_id of Apartment_Buildings.
The apt_id of Apartment_Facilities is the foreign key of apt_id of Apartments.
The guest_id of Apartment_Bookings is the foreign key of guest_id of Guests.
The apt_id of Apartment_Bookings is the foreign key of apt_id of Apartments.
The apt_booking_id of View_Unit_Status is the foreign key of apt_booking_id of Apartment_Bookings.
The apt_id of View_Unit_Status is the foreign key of apt_id of Apartments.

##Role Access Policy (Column-Level):
Role: ReservationAgent
Accessible Columns: Apartments: apt_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count; Guests: guest_id, guest_first_name, guest_last_name; Apartment_Bookings: ALL COLUMNS; View_Unit_Status: apt_id, status_date, available_yn

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 gender codes in descending order of their corresponding number of guests. Return both the gender codes and counts.
Answer: Sorry, I cannot answer.
Permission: denied (Missing column permissions: guests: gender_code)
Gold SQL: SELECT gender_code ,  COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC
##Instruction:
Database: apartment_rentals
Total Tables: 6
Total Columns: 31

Table Schemas:

apartment_rentals contains tables such as Apartment_Buildings, Apartments, Apartment_Facilities, Guests, Apartment_Bookings, View_Unit_Status.
Table Apartment_Buildings has columns such as building_id, building_short_name, building_full_name, building_description, building_address, building_manager, building_phone.
building_id is the primary key.
Table Apartments has columns such as apt_id, building_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count.
apt_id is the primary key.
Table Apartment_Facilities has columns such as apt_id, facility_code.
apt_id is the primary key.
Table Guests has columns such as guest_id, gender_code, guest_first_name, guest_last_name, date_of_birth.
guest_id is the primary key.
Table Apartment_Bookings has columns such as apt_booking_id, apt_id, guest_id, booking_status_code, booking_start_date, booking_end_date.
apt_booking_id is the primary key.
Table View_Unit_Status has columns such as apt_id, apt_booking_id, status_date, available_yn.
status_date is the primary key.
The building_id of Apartments is the foreign key of building_id of Apartment_Buildings.
The apt_id of Apartment_Facilities is the foreign key of apt_id of Apartments.
The guest_id of Apartment_Bookings is the foreign key of guest_id of Guests.
The apt_id of Apartment_Bookings is the foreign key of apt_id of Apartments.
The apt_booking_id of View_Unit_Status is the foreign key of apt_booking_id of Apartment_Bookings.
The apt_id of View_Unit_Status is the foreign key of apt_id of Apartments.

##Role Access Policy (Column-Level):
Role: ReservationAgent
Accessible Columns: Apartments: apt_id, apt_type_code, apt_number, bathroom_count, bedroom_count, room_count; Guests: guest_id, guest_first_name, guest_last_name; Apartment_Bookings: ALL COLUMNS; View_Unit_Status: apt_id, status_date, available_yn

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 apartments do not have any facility?
Answer: Sorry, I cannot answer.
Permission: denied (Missing column permissions: apartment_facilities: apt_id)
Gold SQL: SELECT count(*) FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities)