使用“表继承”(松散地)和连接表之类的概念,我会以这种方式进行设置:
Person
person_id, first_name, last_name, address
Student
student_id, person_id, matr_nr
Teacher
teacher_id, person_id, salary
Lecture
lecture_id, teacher_id, lect_name, lect_description, date
Attendees
lecture_id, student_id
其中 Student 和 Teacher 表从 Person 和 Attendees 表“继承”是 Lecture 和 Student 之间的 Join 表(teacher_id 在 Lecture 表中用于指定谁在教课。并且通过 Join table best practice 该表实际上应该命名为 Lecture_Student或类似的)
替代设计:(允许一个班级的多名教师)
Person
person_id, first_name, last_name, address
Student
student_id, person_id, matr_nr
Teacher
teacher_id, person_id, salary
Lecture
lecture_id, lect_name, lect_description, date
Lecture_Student
lecture_id, student_id
Lecture_Teacher
lecture_id, teacher_id