Here’s what’s in my mind. I’ll emphasize the tables that will be used.
A school contains many Course, for example, Computer Science. Then a course contains many Sections, for example, CS-1, CS-2… etc. Then a section contains many Subjects, for example, Math, English… etc.
I primarily set the relationship of Section and Subject to one-to-many, and the Subject has the
section_id. It doesn’t have any problem when I’m assigning a teacher to a subject because the subject has a section_id, so I can just reference it. But I do have a problem when it comes to Student, because that means that they can enroll to the same subject two or more times but with different sections.
But I thought that the logic between Section and Subject is wrong. Clearly, a subject for example, Math can be taught to multiple sections, and a Section for example, CS-1, have many subjects. But if I did many-to-many, when I assign a teacher to a subject, the subject doesn’t have reference to what section it belongs to. Unless I made it three-way-m:n relationship. Where a table contains user_id/teacher_id, section_id and subject_id.