Skip to content
C

Relationship


Relationship

Definition

A relationship is an association among two or more entities (from the same or different entity sets). It captures how entities are meaningfully connected in the real world. In an ER diagram, a relationship is drawn as a diamond, connected by lines to the entity sets it relates.

Worked Example

Enrolls_In is a relationship connecting Student and Course: it captures the fact that a given student is enrolled in a given course. Belongs_To connects Student and Department. Offers connects Department and Course. Each of these diamonds represents a distinct real-world association, and each may carry its own descriptive attributes (recall 6.5) — e.g., Enrolls_In can carry Grade and Enrollment_Date.

Edge Cases

  • A relationship is fundamentally different from its three closely related "measurement" concepts covered next in this chapter: Relationship Degree (6.12) measures how many entity sets participate in it; Cardinality (6.13) measures how many instances of each entity set can be linked; Participation (6.14) measures whether every instance must take part. "Relationship" itself is just the association — the other three describe different properties of that same association.
  • A relationship can connect an entity set to itself (a recursive relationship, 6.15), such as Manages linking Employee to Employee.
  • The same two entity sets can have more than one distinct relationship between them at once — e.g., Student and Course could have both Enrolls_In and Completed as two separate relationships with different meanings and possibly different cardinalities.
  • A relationship instance is a specific tuple of participating entities (e.g., "Aditi Sharma" enrolled in "CS301"), analogous to how an entity instance is one occurrence of an entity set.

Key Takeaways / Interview Q&A

Q: How is a relationship represented in an ER diagram? A: As a diamond shape, connected by lines to each participating entity set's rectangle.

Q: Can a relationship exist without connecting to any entity set? A: No — by definition, a relationship must associate two or more entity sets (or the same entity set with itself, in a recursive relationship).

Q: Is a relationship the same thing as its cardinality or participation constraint? A: No — the relationship is the association itself; degree, cardinality, and participation are separate descriptive properties layered on top of it, each answering a different question about that association.

Mock Test

  • Relationship - Quick Test

    8 questions on Relationship.

    8 questions · 8 min · Medium
    Start Mock Test