I would use a pivot table, but I donβt see where your problems are coming from. Using a simple student / class example:
Student ------- Id (Primary Key) FirstName LastName Course ------ Id (Primary Key) Title StudentCourse ------------- StudentId (Foreign Key -> Student) CourseId (Foreign Key -> Course)
Or, as someone else mentioned in response to your question "Student / Teacher / Course" (which would have an extra table for storing the type of person in the course):
PersonType ---------- Id (Primary Key) Type Person ------ Id (Primary Key) FirstName LastName Type (Foreign Key -> PersonType) Course ------ Id (Primary Key) Title PersonCourse ------------ PersonId (Foreign Key -> Person) CourseId (Foreign Key -> Course)
The Student table contains information about the student, the course table stores course information ... and the summary table simply contains the identifiers of the corresponding students and courses. This should not lead to any null / empty column or anything else.
source share