N
N
nikitosis2019-05-26 11:08:05
Database design
nikitosis, 2019-05-26 11:08:05

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

1 answer(s)
D
d-stream, 2019-05-26
@d-stream

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 question

Ask a Question

731 491 924 answers to any question