Answer the question
In order to leave comments, you need to log in
How to make such a database structure?
In general, there are 3 tables Student,Teacher,PeopleGroup.
PeopleGroup can include both students and teachers. Students and faculty can belong to more than one PeopleGroup.
How to create a many-to-many relationship?
So far, only one thing comes to mind: create a PeopleGroup_People table, which will contain PeopleGroup_id, Student_id, Teacher_id. And if we add a student to the relationship, then Teacher_id is set to null. If the teacher-Student_id is null.
Answer the question
In order to leave comments, you need to log in
student - person
teacher - person
, so that people can be driven into one essence, but their roles can be different (students, applicants, teachers, graduate students, trainees, laboratory assistants)
roughly estimating the connection - we are also introducing departments-faculties
and now between departments -faculties, you can build a connection with the type:
vasya48 - student -
faculty1 petya-teacher-department2
vasya48-laboratory assistant-department2
that is
1. person:id,+other attributes
2. group:id,+other attributes
3. relation: person_id, group_id , relation_type
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question