0 · Recall Warm-up
Answer from memory first. Answers are in the Answer Vault at the bottom.
- What is a key attribute, and how is it drawn? from Lesson 1.1.2
- Composite or multivalued: a student's several phone numbers? from Lesson 1.1.2
- What is the Cartesian product A × B? from Lesson 0.2.2
1 · The Hook
Asha takes the DBMS course and the Networks course and gets an A in DBMS. That fact is not about Asha alone or about DBMS alone: it is about Asha and DBMS together. The grade belongs to the pair. ER models such facts as relationships.
2 · Predict First
Where should Asha's grade "A in DBMS" be stored: as an attribute of STUDENT, as an attribute of COURSE, or somewhere else?
Make a guess in your head. The answer opens Section 3.
3 · Core Concept
Predict First — the answer
Somewhere else: on the relationship between Asha and DBMS. Asha has a different grade in each course, and each course gives different grades to different students, so the grade depends on the pair. It is a relationship attribute of ENROLLS.
Relationship, relationship type, relationship set
- A relationship is an association between entities: (Asha, DBMS) means "Asha enrols in DBMS".
- A relationship type (schema) such as ENROLLS(STUDENT, COURSE) names the kind of association and the entity types that take part.
- A relationship set (instance) is the set of relationships stored now: {(Asha, DBMS), (Asha, Networks), (Chirag, DBMS), …}.
Since every relationship picks one student and one course, a relationship set of type ENROLLS is a subset of STUDENT × COURSE (Lesson 0.2.2). This is why a relationship set never holds the same pair twice.
Chen notation: diamond joined by lines to the participating entity types.
Degree
The degree of a relationship type is the number of entity types taking part.
- Binary (degree 2): ENROLLS(STUDENT, COURSE). The most common.
- Ternary (degree 3): TEACHES(FACULTY, COURSE, SEMESTER): "Prof. Rao teaches DBMS in Monsoon 2026".
- Unary / recursive (degree 1): an entity type related to itself. MENTORS(STUDENT, STUDENT): a senior student mentors a junior.
Roles
Each entity type in a relationship plays a role. In ENROLLS the roles are obvious. In a recursive relationship the same entity type appears twice, so the roles must be named: in MENTORS one student plays mentor and the other plays mentee. Role names are written on the lines.
Relationship attributes
A relationship type can have attributes, drawn as ellipses on the diamond. grade on ENROLLS; since_date on WORKS_IN. A relationship attribute describes the association, not either entity alone.
Later (Lesson 1.2.2) you will see that for 1:1 or 1:N relationships such an attribute could be moved to one of the entities; for M:N it must stay on the relationship.
4 · Visual
Binary ENROLLS with a relationship attribute (grade); recursive MENTORS with role names.
5 · Worked Examples
Example 1 Easy
Name the degree: (a) WORKS_IN(FACULTY, DEPARTMENT); (b) SUPPLIES(SUPPLIER, PART, PROJECT); (c) REPORTS_TO(EMPLOYEE, EMPLOYEE).
Solution
(a) binary; (b) ternary; (c) unary (recursive), needing roles such as boss and subordinate.
Example 2 Medium
STUDENT has 4 entities and COURSE has 3. What is the largest possible number of relationships in the ENROLLS relationship set?
Solution
The set is a subset of STUDENT × COURSE, which has 4 × 3 = 12 pairs. So at most 12.
Example 3 GATE
Where should each attribute go: (a) the date a faculty member joined a department, where each faculty member is in exactly one department; (b) the marks a student gets in a course?
Solution
(b) marks must be on ENROLLS (it depends on the pair, and a student takes many courses while a course has many students). (a) may be placed on WORKS_IN or, because each faculty member has exactly one department, moved to FACULTY. Lesson 1.2.2 explains why the "one" side allows the move.
6 · GATE Traps
- A relationship set is a set: the same pair cannot appear twice. A student who repeats a course needs something extra (for example a semester entity in a ternary relationship).
- Degree counts entity types taking part, counting a type once per role. A recursive relationship has degree 2 in some books (two roles) and is called unary in others; GATE uses "recursive" or "unary" for one entity type.
- Diamond = relationship; rectangle = entity. A relationship attribute hangs from the diamond.
7 · Memory Hook
"Two nouns and a verb." Students (noun) enrol in (verb, diamond) courses (noun). Facts about the enrolling itself (grade) hang on the verb.
8 · Connect the Dots
Lesson 1.1.2 gave keys to tell entities apart; this lesson linked entities with relationships. Next: how many entities can be linked on each side (1:1, 1:N, M:N) and whether every entity must be linked: the most-tested ER idea in GATE.
9 · Self-Test
GATE format. Try every question before opening the vault.
Q1 · MCQ · 1 mark(s) — Degree
A relationship that links three entity types is:
- (A) weak
- (B) binary
- (C) ternary
- (D) recursive
Q2 · MCQ · 1 mark(s) — Notation
A relationship type is drawn as a:
- (A) double rectangle
- (B) rectangle
- (C) diamond
- (D) ellipse
Q3 · NAT · 1 mark(s) — Counting
FACULTY has 6 entities and COURSE has 5. What is the maximum number of relationships in TEACHES(FACULTY, COURSE)?
Numerical answer: ________
Q4 · MCQ · 2 mark(s) — Relationship attribute
A student's grade in a course should be modelled as:
- (A) an attribute of the ENROLLS relationship
- (B) a separate entity type GRADE with no relationships
- (C) an attribute of COURSE
- (D) an attribute of STUDENT
Q5 · MCQ · 1 mark(s) — Roles
In MENTORS(STUDENT, STUDENT), role names are needed because:
- (A) it is ternary
- (B) the same entity type appears twice
- (C) STUDENT has no key
- (D) the relationship has an attribute
10 · Rule Card
- Relationship = association of entities; relationship type (schema), relationship set (instance) ⊆ E₁ × E₂ × …
- Diamond in Chen notation.
- Degree: unary/recursive (1 type), binary (2), ternary (3).
- Recursive relationships need role names.
- Relationship attributes describe the association (grade on ENROLLS).
- Max size of a binary relationship set = |E₁| × |E₂|.
11 · Concept Ledger
Unlocked in this lesson. From here on, these terms may be used.
relationshiprelationship typerelationship setdegreebinaryternaryunary (recursive) relationshiprolerelationship attributeChen diamond
12 · Answer Vault
Reveal answers when you’re ready
Recall Warm-up
- An attribute whose value is unique for every entity in every possible state; drawn underlined.
- Multivalued.
- The set of all ordered pairs (a, b) with a ∈ A and b ∈ B.
Self-Test
Q1 Answer: (C) · 1 mark(s)
Degree 3.
- (A) is wrong: Not a degree.
- (B) is wrong: Degree 2.
- (D) is wrong: One entity type with itself.
Re-read: Lesson 1.2.1 — Relationship, relationship set, degree, roles, relationship attributes
Q2 Answer: (C) · 1 mark(s)
Diamond.
- (A) is wrong: Weak entity type (Lesson 1.2.3).
- (B) is wrong: Entity type.
- (D) is wrong: Attribute.
Re-read: Lesson 1.2.1 — Relationship, relationship set, degree, roles, relationship attributes
Q3 Answer: 30 · 1 mark(s)
At most |FACULTY × COURSE| = 6 × 5 = 30.
Re-read: Lesson 1.2.1 — Relationship, relationship set, degree, roles, relationship attributes
Q4 Answer: (A) · 2 mark(s)
It depends on the pair of student and course.
- (B) is wrong: Disconnects the grade from the pair.
- (C) is wrong: A course gives many grades.
- (D) is wrong: A student has many grades.
Re-read: Lesson 1.2.1 — Relationship, relationship set, degree, roles, relationship attributes
Q5 Answer: (B) · 1 mark(s)
Roles tell the two appearances apart.
- (A) is wrong: It is recursive.
- (C) is wrong: STUDENT has a key.
- (D) is wrong: Not the reason.
Re-read: Lesson 1.2.1 — Relationship, relationship set, degree, roles, relationship attributes