Skip to content
GATEiit

GATE DA · Database Management and Warehousing

ER model

Entities, attributes, relationships, cardinality and participation, weak entities and specialisation in the ER model, and how to map an ER diagram to the minimum number of relations.

Before you start

  • Sets and tuples

    An entity set is a set of entities, and a relationship set is a set of tuples of entities.

  • Relations, primary keys and foreign keys

    An ER diagram is finally converted into relations linked by primary and foreign keys.

This topic comes before: Data warehouse modelling: schemas for multidimensional data models, Integrity constraints and normal forms, Relational model: relational algebra, tuple calculus and SQL

Concept notes

1. Entities and attributes

An entity is a real-world object we store data about (a student, a course). An entity set is a collection of similar entities and is drawn as a rectangle. Each entity is described by attributes, drawn as ellipses.

Attribute kind Meaning Chen notation
Simple cannot be split (roll number) ellipse
Composite made of parts (name = first + last) ellipse with sub-ellipses
Single-valued one value per entity (date of birth) ellipse
Multivalued many values per entity (phone numbers) double ellipse
Derived computed from others (age from date of birth) dashed ellipse
Key uniquely identifies an entity underlined name

The domain (value set) of an attribute is the set of values it may take. A key attribute (or set of attributes) has distinct values for every entity in the set; a strong entity set always has one.

In the figure, roll and course_id are keys, phone is multivalued, and grade belongs to the relationship, not to either entity: a grade only makes sense for a (student, course) pair.

ER diagram: Student enrolls in CourseSTUDENTENROLLSCOURSEMNrollnamephonegradecourse_idtitle
Chen notation: rectangles are entity sets, the diamond is a relationship set, ellipses are attributes (underlined = key, double = multivalued). ENROLLS is many-to-many with its own attribute grade.

2. Relationships: degree, cardinality and participation

A relationship set (diamond) associates entities from two or more entity sets. Its degree is the number of entity sets involved: binary (2), ternary (3); a recursive relationship links an entity set to itself in different roles (employee supervises employee).

Cardinality ratio (binary): the maximum number of relationship instances an entity can take part in.

  • 1:1 — each entity on either side is related to at most one on the other.
  • 1:N — one department, many employees; each employee in at most one department.
  • M:N — a student takes many courses and a course has many students.

Participation is the minimum:

  • Total (mandatory, drawn with a double line): every entity must take part. Each employee must work in some department.
  • Partial (single line): some entities may not take part.

Cardinality and participation together are sometimes written as (min, max) on each side, e.g. (1, 1) for an employee who works in exactly one department.

Counting instances: if R is 1:1 between sets of sizes m and n, it has at most min⁡(m,n) instances. If R is 1:N with n entities on the N side, it has at most n instances. If R is M:N, at most m⋅n.

3. Weak entity sets

A weak entity set has no key of its own. It is identified only together with an owner (identifying) entity set.

  • Drawn as a double rectangle; its identifying relationship is a double diamond.
  • It has a partial key (discriminator), drawn with a dashed underline, that is unique only among the weak entities of the same owner.
  • A weak entity set always has total participation in the identifying relationship, and the relationship is 1:N (or 1:1) from owner to weak entity.

Primary key of a weak entity's relation = primary key of the owner + partial key.

Example: LOAN (loan_no) and PAYMENT (payment_no, date, amount). Payment 1 of loan L17 and payment 1 of loan L42 are different payments, so payment_no alone is not a key. The PAYMENT relation is (loan_no, payment_no, date, amount) with key (loan_no, payment_no), and loan_no is a foreign key to LOAN. The identifying relationship needs no separate table.

Strong vs weak: a strong entity set has its own primary key; a weak one borrows the owner's key. Deleting an owner usually deletes its weak entities (ON DELETE CASCADE).

4. Mapping an ER diagram to relations

GATE often asks for the minimum number of relations (tables). Apply these rules:

ER construct Relations needed
Strong entity set 1 (its simple attributes; composite attributes flattened; derived attributes dropped)
Multivalued attribute 1 extra: (key of entity, attribute value)
Weak entity set 1, key = owner key + partial key
M:N relationship 1 extra: keys of both sides + its own attributes
1:N relationship 0 extra: put the 1-side key as a foreign key in the N-side relation
1:1, partial on at least one side 0 extra: foreign key on one side (prefer the total-participation side)
1:1, total on both sides the two entity sets can be merged into one relation
n-ary relationship (n ≥ 3) 1 extra, with keys of all participants

The key of an M:N relationship's relation is the combination of both foreign keys. For a 1:N relationship merged into the N side, the foreign key column is NOT NULL when the N side has total participation, and may be NULL otherwise.

Derived attributes are not stored. Multivalued attributes cannot be columns, because a relation must be in 1NF (atomic values).

5. Specialisation, generalisation and aggregation

Specialisation (top-down) splits an entity set into subclasses: EMPLOYEE into ENGINEER and MANAGER. Generalisation (bottom-up) combines similar entity sets into a superclass. Both form an ISA hierarchy; subclasses inherit the superclass attributes and key.

Constraints on the hierarchy:

  • Disjoint (an entity is in at most one subclass) vs overlapping.
  • Total (every superclass entity is in some subclass) vs partial.

Mapping choices:

  1. One relation for the superclass and one per subclass, each subclass holding the superclass key (works always).
  2. One relation per subclass only, each with all inherited attributes (works when the specialisation is total and disjoint).
  3. A single relation with all attributes and a type column (many NULLs).

Aggregation treats a relationship set (with its participating entities) as a higher-level entity so that it can take part in another relationship. Example: the relationship WORKS_ON(employee, project) is monitored by a MANAGER; MONITORS relates MANAGER to the aggregate WORKS_ON. It is used when a relationship must relate to another relationship, which plain ER cannot express.

Formulas to remember

Weak entity key
PK(weak)=PK(owner)∪partial key
M:N relationship relation key
PK(R)=PK(E1)∪PK(E2)
Maximum instances of a binary relationshipm and n are the entity-set sizes; in 1:N, n is the size of the N side.
1:1→min⁡(m,n),1:N→n,M:N→m n

Common mistakes

  • Creating a separate relation for every 1:N relationship; a foreign key on the N side is enough.
  • Putting the foreign key on the 1 side of a 1:N relationship, which would need many values in one column.
  • Using only the partial key as the key of a weak entity's relation.
  • Storing a multivalued attribute as a column (breaks 1NF) or storing a derived attribute at all.
  • Merging a 1:1 relationship into one relation when participation is not total on both sides; unmatched entities would need NULL keys.
  • Confusing cardinality (maximum) with participation (minimum).

Worked examples

Try each step yourself, then reveal the working.

Example 1: Minimum number of relations

numerical

Entity sets E1, E2, E3 are strong. E1 has one multivalued attribute. R1 is an M:N relationship between E1 and E2; R2 is a 1:N relationship from E2 (one) to E3 (many). Find the minimum number of relations.

  1. Step 1: Count the entity relations.

    Try it on paper first.

Example 2: Mapping a weak entity set

conceptual

BUILDING (bldg_id, address) owns ROOM (room_no, capacity) through the identifying relationship HAS. Room numbers repeat across buildings. Give the relations and their keys.

  1. Step 1: Decide which entity set is weak.

    Try it on paper first.

Example 3: Columns after mapping an entity

numerical

EMPLOYEE has attributes emp_id (key), name (composite: first, last), dob, age (derived from dob) and phones (multivalued). How many relations and how many columns in total after mapping?

  1. Step 1: Map the entity itself.

    Try it on paper first.

Example 4: One-to-one with total participation on both sides

conceptual

Every CAR has exactly one ENGINE and every ENGINE is fitted in exactly one CAR. The relationship FITTED is 1:1 with total participation on both sides. What is the minimum number of relations?

  1. Step 1: Ask whether any entity can exist without the other.

    Try it on paper first.

Previous year questions

1 official GATE DA question on this topic, newest first.

Practise these 1 PYQs →

Topic test

9 questions: up to 1 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE DA syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.