Reputation: 119
I have these entities in ER model from my project:
Should I connect them with ternary relationship, or each one with binary relationships? I used ternary relationship. Maybe i don't have the best possible name for the relationship, but it involves grading.
And also if i should use ternary relationship which Ids from connected tables should i use as primary key for the table which will represent relationship in database
Upvotes: 1
Views: 2872
Reputation: 10064
Based on your diagram, it seems that each Student
/Subject
combination determines a Professor
. Let's compare this with binary relationships:
A binary relationship between Student
and Subject
would allow you to record which Students
are taking which Subjects
, without specifying which Professor
. Is that valid for your system, or is it necessary to capture the Professor
for every Student
/Subject
combination?
A binary relationship between Student
and Professor
would record a Professor
for each Student
, or possibly a set of of Professors
for each Student
. Is this useful without knowing which subject each Professor
teaches to the Student
?
A binary relationship between Subject
and Professor
would record one or more Professors
for each subject. That could be useful to capture what a Professor
is able or qualified to teach, as opposed to what they're assigned or scheduled to teach.
I've worked on two school administration systems, and we captured (Student PK, Subject PK)
(subjects taken by students) and (Professor PK, Subject PK)
(subjects that can be taught be professors), but instead of a ternary relationship (Student PK, Subject PK, Professor)
, we defined a subject group or section Sections (SectionID PK, Subject, Professor)
and student section allocation (Student PK, Subject PK, SectionID)
. Subject groups or sections provide a convenient place to attach further attributes, like Room number, timetabling arrangements, tuition language, etc.
Upvotes: 2