∑GATE DA Atlas

The Entity–Relationship Model

Entities, entity sets and attributes (simple, composite, multivalued, derived, key), relationships with degree, cardinality ratios and participation constraints, weak entity sets, specialisation, generalisation and aggregation, ER notation, and the rules for converting an ER diagram into relational tables (including the minimum number of tables).

Section 59 practice questions

Purpose

The ER model is a conceptual design tool: before choosing tables, describe the real-world things (entities), their properties (attributes) and the associations among them (relationships). The diagram is then mapped mechanically to a relational schema.

Entities and attributes

An entity is a distinguishable object (a student, a course); an entity set is a collection of similar entities.

Attribute typeExampleDiagram (Chen)
Simple (atomic)roll_noellipse
Compositename = (first, last)ellipse with sub-ellipses
Single-valueddobellipse
Multivaluedphone_numbersdouble ellipse
Derivedage (from dob)dashed ellipse
Keyroll_nounderlined

Keys: a superkey uniquely identifies an entity; a candidate key is a minimal superkey; the primary key is the candidate key chosen by the designer.

Relationships

A relationship set associates entities from entity sets; it may have descriptive attributes (e.g. grade on Enrolls).

  • Degree: number of participating entity sets (unary/recursive, binary, ternary).
  • Cardinality ratio (for binary relationships): 1:1, 1:N, M:N — the maximum number of relationship instances an entity can take part in.
  • Participation: total (every entity must participate; double line) or partial.
  • Roles label the ends of recursive relationships (an employee manages another employee).
Student Course Enrolls MN grade roll_no name course_id double line: every course has at least one student (total participation)
Students enrol in many courses; each course has many students; grade belongs to the relationship.

Weak entity sets

A weak entity set has no key of its own. It is identified by:

  • an owner (identifying) entity set,
  • an identifying relationship (double diamond) in which it participates totally, and
  • a partial key (discriminator, dashed underline).

Example: Payment(payment_no, amount) of a Loan: the key of Payment is (loan_id, payment_no).

Extended ER features

  • Specialisation (top-down): sub-groups of an entity set with extra attributes (Employee → Engineer, Manager). Generalisation is the bottom-up view. Constraints: disjoint vs overlapping, total vs partial. Subclasses inherit attributes and relationships.
  • Aggregation: treat a relationship as an entity so it can participate in another relationship (a Works_on relationship monitored by a Manager).

From ER diagram to tables

ER constructRelational mapping
Strong entity settable with its simple attributes; composite attributes flattened
Weak entity settable with its attributes + owner's key; PK = owner key + partial key
1:1 relationshipforeign key on either side (prefer the side with total participation); with total participation on both sides, merge into one table
1:N relationshipforeign key on the N side (plus relationship attributes)
M:N relationshipseparate table with both keys (PK = the pair) + attributes
nn-ary relationshipseparate table with all participating keys
Multivalued attributeseparate table (entity key, value)
Derived attributeusually not stored
Specialisationa table per subclass with the superclass key (or one table with a type column)

Quick revision

Practice questions

GATE-style questions: 4 one-mark and 5 two-mark. Wrong MCQs cost ⅓ of their marks in the real exam; MSQ and NAT have no negative marking. Attempt each before opening the solution.

Q1MCQ1 mark

A weak entity set is one that

Q2NAT2 marks

An ER diagram has two strong entity sets AA (key aa) and BB (key bb), connected by a many-to-many relationship RR with one descriptive attribute. The minimum number of relational tables needed is ______.

Q3NAT2 marks

Entity sets AA and BB are connected by a one-to-many relationship RR (each AA relates to many BB, each BB to at most one AA). The minimum number of tables required is ______.

Q4MCQ1 mark

When an ER diagram is converted to relations, a multivalued attribute (e.g. an employee's several phone numbers) becomes

Q5MSQ2 marks

Which statements about the ER model are correct?

One or more options are correct.

Q6NAT2 marks

A ternary relationship connects three strong entity sets AA, BB, CC, and is many-to-many-to-many. The minimum number of tables is ______.

Q7MCQ2 marks

Entity sets AA and BB are connected by a one-to-one relationship in which both AA and BB participate totally. The minimum number of tables is

Q8NAT1 mark

The degree of a relationship set that associates entities from three different entity sets is ______.

Q9MCQ1 mark

In Chen's ER notation, a double rectangle represents