Should a TeamMembers table have a relationship with the Student Table or the Enrolment Table

database-designerdtable

I'll keep it nice and short and simply link to the ERD:

ERD

Users can be assigned a role, one of those is student.
So for the sake of this, Students are the same as Users!

A Student can be enrolled in many OfferedUnits. A Student can also be in Many Teams and a Team can have Many Students.

The issue I am having is this: Should the Many-to-Many relationship that allows a Student to be in many teams and a Team to have many students be between the Users Table and the Teams Table or the Enrollment Table and the Teams table?

The argument for the Enrollment option is as such: You will only be able to assign a Team to Enrolled students. That's the only reason I can think of doing it that way.

Otherwise, it logically doesn't make sense to connect Enrollment to Teams, because it's the STUDENT who is in a Team, not their Enrollment.

What do you think?

Best Answer

I would have assumed that one team can have many users and one user can be part of many teams thus creating a new junction table, Users_Team. From there I would have related users to Enrollment or user_team to enrollments depending on business logic. Am I right in assuming that enrollment will contain recrods such as Maths, Science, Art etc...?

Does it make sense for a user to be enrolled in maths as a individual, and also as a team?

From my understanding, I would drop that TeamMembers table.