Correct option is D
When an entity type participates in a relationship with itself, it’s called a recursive (unary) relationship.
Examples include an employee manages another employee, or a course has prerequisite course.
Cardinality can still be 1:1, 1:N, or M:N, but the entity set on both sides is the same.
In ER modeling, you distinguish the roles with role names (e.g., manager vs subordinate).
Implementation typically uses a self-referencing foreign key in the same table.
Thus, a self-relationship is termed recursive.
Cardinality can still be 1:1, 1:N, or M:N, but the entity set on both sides is the same.
In ER modeling, you distinguish the roles with role names (e.g., manager vs subordinate).
Implementation typically uses a self-referencing foreign key in the same table.
Thus, a self-relationship is termed recursive.
Important Key Points
- Also called “unary” relationship (vs binary/ternary).
- Role names are essential to avoid ambiguity (e.g., parent/child in a hierarchy).
- Cardinality still applies: can be 1:1, 1:N, or M:N.
- Schema pattern: Add a nullable foreign key referencing the same table (e.g., Employees(ManagerID → Employees.EmployeeID)).
- Integrity rules: Use constraints to prevent cycles where inappropriate (e.g., a manager cannot manage themself).
- Querying: Hierarchical queries may use recursive CTEs (SQL WITH RECURSIVE) for multi-level traversals.
Knowledge Booster
- Why not (a) / (b) / (c)? These describe cardinalities (1:N, 1:1, M:N) but don’t indicate that the relationship is self-referential. A recursive relationship can have any of these cardinalities; the defining feature is that the same entity appears on both sides.