Relationship Degree
Relationship Degree
Definition
The degree of a relationship is the number of entity sets that participate in it. It answers the question "how many distinct entity sets does this relationship connect?" — a structural property, entirely separate from cardinality (how many instances can relate) or participation (whether participation is mandatory).
Worked Example
- A unary (degree 1) relationship connects an entity set to itself:
Manages, linkingEmployeetoEmployee(an employee manages another employee) — this is the same construct as the recursive relationship (6.15). - A binary (degree 2) relationship connects two distinct entity sets — the most common case:
Enrolls_InconnectsStudentandCourse. - A ternary (degree 3) relationship connects three entity sets simultaneously: for instance, a
Teachesrelationship connectingFaculty,Course, andSemestertogether (capturing that a specific faculty member teaches a specific course in a specific semester — information that cannot be fully captured by three separate binary relationships without losing the combined meaning). - Degrees higher than three (n-ary) are possible but rare, since they quickly become hard to design, query, and reason about; ternary or higher relationships are often decomposed into binary relationships with an intermediate entity when practical.
Edge Cases
- Degree is a count of entity sets, not a count of entity instances — do not confuse it with cardinality. A binary relationship (degree 2) can still have an M:N cardinality (many instances on each side); degree and cardinality answer completely different questions.
- A ternary relationship is NOT simply "three binary relationships mashed together" — decomposing a genuine ternary relationship into three binary ones can lose information (e.g., you could no longer be certain which Faculty+Course+Semester combinations are jointly valid versus which are just independently paired).
- The most common mistake is calling a unary/recursive relationship "not a real relationship" because it only names one entity set — it is still degree 1, a fully valid relationship.
Key Takeaways / Interview Q&A
Q: What does "degree" measure in an ER relationship, in one sentence? A: The number of entity sets participating in that relationship (1 = unary, 2 = binary, 3 = ternary, etc.).
Q: Is a binary relationship always one-to-one? A: No — "binary" only refers to degree (two entity sets involved); the cardinality of a binary relationship can independently be 1:1, 1:N, or M:N.
Q: Why might Teaches(Faculty, Course, Semester) need to be ternary instead of split into two binary relationships? A: Because a ternary relationship captures which specific combinations of all three are valid together; splitting it into Faculty-Course and Course-Semester separately would allow invalid combinations to be reconstructed that were never actually true.