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

Table Schemas:

e_learning contains tables such as Course_Authors_and_Tutors, Students, Subjects, Courses, Student_Course_Enrolment, Student_Tests_Taken.
Table Course_Authors_and_Tutors has columns such as author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1.
author_id is the primary key.
Table Students has columns such as student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name.
student_id is the primary key.
Table Subjects has columns such as subject_id, subject_name.
subject_id is the primary key.
Table Courses has columns such as course_id, author_id, subject_id, course_name, course_description.
course_id is the primary key.
Table Student_Course_Enrolment has columns such as registration_id, student_id, course_id, date_of_enrolment, date_of_completion.
registration_id is the primary key.
Table Student_Tests_Taken has columns such as registration_id, date_test_taken, test_result.
The subject_id of Courses is the foreign key of subject_id of Subjects.
The author_id of Courses is the foreign key of author_id of Course_Authors_and_Tutors.
The student_id of Student_Course_Enrolment is the foreign key of student_id of Students.
The course_id of Student_Course_Enrolment is the foreign key of course_id of Courses.
The registration_id of Student_Tests_Taken is the foreign key of registration_id of Student_Course_Enrolment.

##Role Access Policy (Column-Level):
Role: EnrollmentManager
Accessible Columns: Students: student_id, date_of_registration, personal_name, middle_name, family_name; Courses: course_id, course_name; Student_Course_Enrolment: ALL COLUMNS

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 subject ID, subject name, and the corresponding number of available courses for each subject.
Answer: Sorry, I cannot answer.
Permission: denied (Missing column permissions: courses: subject_id; subjects: subject_id, subject_name)
Gold SQL: SELECT T1.subject_id ,  T2.subject_name ,  COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id  =  T2.subject_id GROUP BY T1.subject_id
##Instruction:
Database: e_learning
Total Tables: 6
Total Columns: 32

Table Schemas:

e_learning contains tables such as Course_Authors_and_Tutors, Students, Subjects, Courses, Student_Course_Enrolment, Student_Tests_Taken.
Table Course_Authors_and_Tutors has columns such as author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1.
author_id is the primary key.
Table Students has columns such as student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name.
student_id is the primary key.
Table Subjects has columns such as subject_id, subject_name.
subject_id is the primary key.
Table Courses has columns such as course_id, author_id, subject_id, course_name, course_description.
course_id is the primary key.
Table Student_Course_Enrolment has columns such as registration_id, student_id, course_id, date_of_enrolment, date_of_completion.
registration_id is the primary key.
Table Student_Tests_Taken has columns such as registration_id, date_test_taken, test_result.
The subject_id of Courses is the foreign key of subject_id of Subjects.
The author_id of Courses is the foreign key of author_id of Course_Authors_and_Tutors.
The student_id of Student_Course_Enrolment is the foreign key of student_id of Students.
The course_id of Student_Course_Enrolment is the foreign key of course_id of Courses.
The registration_id of Student_Tests_Taken is the foreign key of registration_id of Student_Course_Enrolment.

##Role Access Policy (Column-Level):
Role: EnrollmentManager
Accessible Columns: Students: student_id, date_of_registration, personal_name, middle_name, family_name; Courses: course_id, course_name; Student_Course_Enrolment: ALL COLUMNS

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 subject ID, subject name, and the number of available courses for each subject?
Answer: Sorry, I cannot answer.
Permission: denied (Missing column permissions: courses: subject_id; subjects: subject_id, subject_name)
Gold SQL: SELECT T1.subject_id ,  T2.subject_name ,  COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id  =  T2.subject_id GROUP BY T1.subject_id
##Instruction:
Database: e_learning
Total Tables: 6
Total Columns: 32

Table Schemas:

e_learning contains tables such as Course_Authors_and_Tutors, Students, Subjects, Courses, Student_Course_Enrolment, Student_Tests_Taken.
Table Course_Authors_and_Tutors has columns such as author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1.
author_id is the primary key.
Table Students has columns such as student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name.
student_id is the primary key.
Table Subjects has columns such as subject_id, subject_name.
subject_id is the primary key.
Table Courses has columns such as course_id, author_id, subject_id, course_name, course_description.
course_id is the primary key.
Table Student_Course_Enrolment has columns such as registration_id, student_id, course_id, date_of_enrolment, date_of_completion.
registration_id is the primary key.
Table Student_Tests_Taken has columns such as registration_id, date_test_taken, test_result.
The subject_id of Courses is the foreign key of subject_id of Subjects.
The author_id of Courses is the foreign key of author_id of Course_Authors_and_Tutors.
The student_id of Student_Course_Enrolment is the foreign key of student_id of Students.
The course_id of Student_Course_Enrolment is the foreign key of course_id of Courses.
The registration_id of Student_Tests_Taken is the foreign key of registration_id of Student_Course_Enrolment.

##Role Access Policy (Column-Level):
Role: EnrollmentManager
Accessible Columns: Students: student_id, date_of_registration, personal_name, middle_name, family_name; Courses: course_id, course_name; Student_Course_Enrolment: ALL COLUMNS

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 subject ID, name of subject and the corresponding number of courses for each subject, and sort by the course count in ascending order.
Answer: Sorry, I cannot answer.
Permission: denied (Missing column permissions: courses: subject_id; subjects: subject_id, subject_name)
Gold SQL: SELECT T1.subject_id ,  T2.subject_name ,  COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id  =  T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC
##Instruction:
Database: e_learning
Total Tables: 6
Total Columns: 32

Table Schemas:

e_learning contains tables such as Course_Authors_and_Tutors, Students, Subjects, Courses, Student_Course_Enrolment, Student_Tests_Taken.
Table Course_Authors_and_Tutors has columns such as author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1.
author_id is the primary key.
Table Students has columns such as student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name.
student_id is the primary key.
Table Subjects has columns such as subject_id, subject_name.
subject_id is the primary key.
Table Courses has columns such as course_id, author_id, subject_id, course_name, course_description.
course_id is the primary key.
Table Student_Course_Enrolment has columns such as registration_id, student_id, course_id, date_of_enrolment, date_of_completion.
registration_id is the primary key.
Table Student_Tests_Taken has columns such as registration_id, date_test_taken, test_result.
The subject_id of Courses is the foreign key of subject_id of Subjects.
The author_id of Courses is the foreign key of author_id of Course_Authors_and_Tutors.
The student_id of Student_Course_Enrolment is the foreign key of student_id of Students.
The course_id of Student_Course_Enrolment is the foreign key of course_id of Courses.
The registration_id of Student_Tests_Taken is the foreign key of registration_id of Student_Course_Enrolment.

##Role Access Policy (Column-Level):
Role: EnrollmentManager
Accessible Columns: Students: student_id, date_of_registration, personal_name, middle_name, family_name; Courses: course_id, course_name; Student_Course_Enrolment: ALL COLUMNS

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 subject ID, name of subject and the number of courses available for each subject in ascending order of the course counts.
Answer: Sorry, I cannot answer.
Permission: denied (Missing column permissions: courses: subject_id; subjects: subject_id, subject_name)
Gold SQL: SELECT T1.subject_id ,  T2.subject_name ,  COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id  =  T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC
##Instruction:
Database: e_learning
Total Tables: 6
Total Columns: 32

Table Schemas:

e_learning contains tables such as Course_Authors_and_Tutors, Students, Subjects, Courses, Student_Course_Enrolment, Student_Tests_Taken.
Table Course_Authors_and_Tutors has columns such as author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1.
author_id is the primary key.
Table Students has columns such as student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name.
student_id is the primary key.
Table Subjects has columns such as subject_id, subject_name.
subject_id is the primary key.
Table Courses has columns such as course_id, author_id, subject_id, course_name, course_description.
course_id is the primary key.
Table Student_Course_Enrolment has columns such as registration_id, student_id, course_id, date_of_enrolment, date_of_completion.
registration_id is the primary key.
Table Student_Tests_Taken has columns such as registration_id, date_test_taken, test_result.
The subject_id of Courses is the foreign key of subject_id of Subjects.
The author_id of Courses is the foreign key of author_id of Course_Authors_and_Tutors.
The student_id of Student_Course_Enrolment is the foreign key of student_id of Students.
The course_id of Student_Course_Enrolment is the foreign key of course_id of Courses.
The registration_id of Student_Tests_Taken is the foreign key of registration_id of Student_Course_Enrolment.

##Role Access Policy (Column-Level):
Role: EnrollmentManager
Accessible Columns: Students: student_id, date_of_registration, personal_name, middle_name, family_name; Courses: course_id, course_name; Student_Course_Enrolment: ALL COLUMNS

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 date of enrollment of the course named "Spanish"?
Answer: SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id WHERE T1.course_name  =  "Spanish"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id WHERE T1.course_name  =  "Spanish"
##Instruction:
Database: e_learning
Total Tables: 6
Total Columns: 32

Table Schemas:

e_learning contains tables such as Course_Authors_and_Tutors, Students, Subjects, Courses, Student_Course_Enrolment, Student_Tests_Taken.
Table Course_Authors_and_Tutors has columns such as author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1.
author_id is the primary key.
Table Students has columns such as student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name.
student_id is the primary key.
Table Subjects has columns such as subject_id, subject_name.
subject_id is the primary key.
Table Courses has columns such as course_id, author_id, subject_id, course_name, course_description.
course_id is the primary key.
Table Student_Course_Enrolment has columns such as registration_id, student_id, course_id, date_of_enrolment, date_of_completion.
registration_id is the primary key.
Table Student_Tests_Taken has columns such as registration_id, date_test_taken, test_result.
The subject_id of Courses is the foreign key of subject_id of Subjects.
The author_id of Courses is the foreign key of author_id of Course_Authors_and_Tutors.
The student_id of Student_Course_Enrolment is the foreign key of student_id of Students.
The course_id of Student_Course_Enrolment is the foreign key of course_id of Courses.
The registration_id of Student_Tests_Taken is the foreign key of registration_id of Student_Course_Enrolment.

##Role Access Policy (Column-Level):
Role: EnrollmentManager
Accessible Columns: Students: student_id, date_of_registration, personal_name, middle_name, family_name; Courses: course_id, course_name; Student_Course_Enrolment: ALL COLUMNS

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 date of enrollment of the "Spanish" course.
Answer: SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id WHERE T1.course_name  =  "Spanish"
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id WHERE T1.course_name  =  "Spanish"
##Instruction:
Database: e_learning
Total Tables: 6
Total Columns: 32

Table Schemas:

e_learning contains tables such as Course_Authors_and_Tutors, Students, Subjects, Courses, Student_Course_Enrolment, Student_Tests_Taken.
Table Course_Authors_and_Tutors has columns such as author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1.
author_id is the primary key.
Table Students has columns such as student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name.
student_id is the primary key.
Table Subjects has columns such as subject_id, subject_name.
subject_id is the primary key.
Table Courses has columns such as course_id, author_id, subject_id, course_name, course_description.
course_id is the primary key.
Table Student_Course_Enrolment has columns such as registration_id, student_id, course_id, date_of_enrolment, date_of_completion.
registration_id is the primary key.
Table Student_Tests_Taken has columns such as registration_id, date_test_taken, test_result.
The subject_id of Courses is the foreign key of subject_id of Subjects.
The author_id of Courses is the foreign key of author_id of Course_Authors_and_Tutors.
The student_id of Student_Course_Enrolment is the foreign key of student_id of Students.
The course_id of Student_Course_Enrolment is the foreign key of course_id of Courses.
The registration_id of Student_Tests_Taken is the foreign key of registration_id of Student_Course_Enrolment.

##Role Access Policy (Column-Level):
Role: EnrollmentManager
Accessible Columns: Students: student_id, date_of_registration, personal_name, middle_name, family_name; Courses: course_id, course_name; Student_Course_Enrolment: ALL COLUMNS

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 name of the course that has the most student enrollment?
Answer: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1
##Instruction:
Database: e_learning
Total Tables: 6
Total Columns: 32

Table Schemas:

e_learning contains tables such as Course_Authors_and_Tutors, Students, Subjects, Courses, Student_Course_Enrolment, Student_Tests_Taken.
Table Course_Authors_and_Tutors has columns such as author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1.
author_id is the primary key.
Table Students has columns such as student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name.
student_id is the primary key.
Table Subjects has columns such as subject_id, subject_name.
subject_id is the primary key.
Table Courses has columns such as course_id, author_id, subject_id, course_name, course_description.
course_id is the primary key.
Table Student_Course_Enrolment has columns such as registration_id, student_id, course_id, date_of_enrolment, date_of_completion.
registration_id is the primary key.
Table Student_Tests_Taken has columns such as registration_id, date_test_taken, test_result.
The subject_id of Courses is the foreign key of subject_id of Subjects.
The author_id of Courses is the foreign key of author_id of Course_Authors_and_Tutors.
The student_id of Student_Course_Enrolment is the foreign key of student_id of Students.
The course_id of Student_Course_Enrolment is the foreign key of course_id of Courses.
The registration_id of Student_Tests_Taken is the foreign key of registration_id of Student_Course_Enrolment.

##Role Access Policy (Column-Level):
Role: EnrollmentManager
Accessible Columns: Students: student_id, date_of_registration, personal_name, middle_name, family_name; Courses: course_id, course_name; Student_Course_Enrolment: ALL COLUMNS

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 course is enrolled in by the most students? Give me the course name.
Answer: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1
##Instruction:
Database: e_learning
Total Tables: 6
Total Columns: 32

Table Schemas:

e_learning contains tables such as Course_Authors_and_Tutors, Students, Subjects, Courses, Student_Course_Enrolment, Student_Tests_Taken.
Table Course_Authors_and_Tutors has columns such as author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1.
author_id is the primary key.
Table Students has columns such as student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name.
student_id is the primary key.
Table Subjects has columns such as subject_id, subject_name.
subject_id is the primary key.
Table Courses has columns such as course_id, author_id, subject_id, course_name, course_description.
course_id is the primary key.
Table Student_Course_Enrolment has columns such as registration_id, student_id, course_id, date_of_enrolment, date_of_completion.
registration_id is the primary key.
Table Student_Tests_Taken has columns such as registration_id, date_test_taken, test_result.
The subject_id of Courses is the foreign key of subject_id of Subjects.
The author_id of Courses is the foreign key of author_id of Course_Authors_and_Tutors.
The student_id of Student_Course_Enrolment is the foreign key of student_id of Students.
The course_id of Student_Course_Enrolment is the foreign key of course_id of Courses.
The registration_id of Student_Tests_Taken is the foreign key of registration_id of Student_Course_Enrolment.

##Role Access Policy (Column-Level):
Role: EnrollmentManager
Accessible Columns: Students: student_id, date_of_registration, personal_name, middle_name, family_name; Courses: course_id, course_name; Student_Course_Enrolment: ALL COLUMNS

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 the courses that have exactly 1 student enrollment?
Answer: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name HAVING COUNT(*)  =  1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name HAVING COUNT(*)  =  1
##Instruction:
Database: e_learning
Total Tables: 6
Total Columns: 32

Table Schemas:

e_learning contains tables such as Course_Authors_and_Tutors, Students, Subjects, Courses, Student_Course_Enrolment, Student_Tests_Taken.
Table Course_Authors_and_Tutors has columns such as author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1.
author_id is the primary key.
Table Students has columns such as student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name.
student_id is the primary key.
Table Subjects has columns such as subject_id, subject_name.
subject_id is the primary key.
Table Courses has columns such as course_id, author_id, subject_id, course_name, course_description.
course_id is the primary key.
Table Student_Course_Enrolment has columns such as registration_id, student_id, course_id, date_of_enrolment, date_of_completion.
registration_id is the primary key.
Table Student_Tests_Taken has columns such as registration_id, date_test_taken, test_result.
The subject_id of Courses is the foreign key of subject_id of Subjects.
The author_id of Courses is the foreign key of author_id of Course_Authors_and_Tutors.
The student_id of Student_Course_Enrolment is the foreign key of student_id of Students.
The course_id of Student_Course_Enrolment is the foreign key of course_id of Courses.
The registration_id of Student_Tests_Taken is the foreign key of registration_id of Student_Course_Enrolment.

##Role Access Policy (Column-Level):
Role: EnrollmentManager
Accessible Columns: Students: student_id, date_of_registration, personal_name, middle_name, family_name; Courses: course_id, course_name; Student_Course_Enrolment: ALL COLUMNS

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 names of the courses that have just one student enrollment.
Answer: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name HAVING COUNT(*)  =  1
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id  =  T2.course_id GROUP BY T1.course_name HAVING COUNT(*)  =  1