I am developing a database that shows the educational process in college.
Students specialize in the departments and they have a supervisor of their department.
In the fourth year students write bachelor’s graduate work, which criticizes a teacher from another department.
I identified several entities: departments, students, teachers. And additional entity: works
STUDENTS table
- stud_id
- name
- dep_id
WORKS table
- work_id
- title
- supervisor_id
- critic_id
- stud_id
TEACHERS table
- teach_id
- name
- dep_id
DEPARTMENS table
- dep_id
- title
It turns out that the fields supervisor_id and critic_id link to a field teach_id in the table TEACHERS. How can I solve this problem? Thanks.
It may be the case where a Teacher may not also be a Supervisor.
You need an extra table- SUPERVISORS, just like TEACHERS, however, instead of “name” and “dep_id”, those fields go into another table called “STAFF”.
So, SUPERVISORS and TEACHERS both have a field called “staff_id” which joins to STAFF for their name/department, and SUPERVISOR_ID links to a SUPERVISOR, while CRITIC_ID links to a TEACHER.
To summarize, 6 tables: STUDENTS, STAFF, WORKS, TEACHERS, SUPERVISORS, DEPARTMENTS.
Join Works to Students by stud_id, to Supervisors by supervisor_id, and to Teachers by critic_id
Join Supervisors to Staff by staff_id
Join Teachers to Staff by staff_id
Join Staff to Departments by dep_id
Make sense?