The E-R model (Peter Chen, 1976) describes data as entities, attributes and relationships with cardinality and participation constraints. Extended E-R adds specialization, generalization and aggregation, and a fixed set of mapping rules turns any diagram into relational tables.
High-yield 50 minSyllabus: “E-R model”
Mark as
The idea in one minute
Before building a house you draw a blueprint. An E-R diagram is the blueprint of a database: rectangles are the things you keep data about (employees, departments), ovals are their properties, diamonds are the verbs that connect them ('works in'), and the 1s and Ns on the lines say 'one department has many employees'. Mapping rules then turn the blueprint into real tables, the way a contractor turns a drawing into rooms.
Key points — the night-before list
Entity = distinguishable real-world object; entity set = collection of similar entities (rectangle). Relationship set = association among entity sets (diamond).
Weak entity (double rectangle): no key of its own; identified by owner's key + partial key (dashed underline) through an identifying relationship (double diamond) with total participation.
Degree: unary (recursive, with role names), binary, ternary. Cardinality ratio: 1:1, 1:N, M:N. Participation: total (double line) or partial (single line).
(min, max) on the E side means each E entity takes part at least min and at most max times; min ≥ 1 ⇒ total participation.
EER: specialization (top-down) and generalization (bottom-up) with ISA; disjoint (d) vs overlapping (o); total vs partial; aggregation treats a relationship as an entity.
Mapping: entity → table; weak → owner PK + partial key; 1:N → FK on N side; 1:1 → FK on total side; M:N and multivalued → new tables.
Minimum tables: M:N → 3, 1:N → 2, 1:1 with total participation on both sides → 1; each multivalued attribute adds a table.
01Entities, entity sets and attributes
The entity–relationship (E-R) model, proposed by Peter Chen in 1976, is a conceptual data model: it captures what the organisation needs to remember, before any table is designed. Its three building blocks are entities, attributes and relationships. E-R design usually proceeds top-down from the whole enterprise towards details.
An entity is a thing or object in the real world that can be distinguished from other objects — the employee Bindu, the department Research, the project AI Lab. An entity set (entity type) is the collection of all entities of the same kind that share the same attributes: EMPLOYEE, DEPARTMENT, PROJECT. An attribute is a property of an entity, and the set of values it may take is its domain (value set).
Attribute kind
Meaning
Example (housing-board ALLOTTEE)
Chen symbol
Simple (atomic)
Cannot be divided further
gender
Ellipse
Composite
Made of meaningful sub-parts
name = (first, middle, last); address = (house, street, city, PIN)
Ellipse with sub-ellipses attached
Single-valued
One value per entity
date_of_birth
Ellipse
Multivalued
A set of values per entity
phone_numbers {9447…, 9846…}
Double ellipse
Stored
Value is recorded
date_of_birth
Ellipse
Derived
Computed from other attributes
age (from date_of_birth), number_of_instalments_paid
Dashed ellipse
Key
Uniquely identifies each entity
allottee_id
Name underlined
NULL-able
Value may be unknown or not applicable
middle_name, email
Ellipse (no special symbol)
Attribute types
Attributes can combine kinds: a person's addresses may be both composite and multivalued (a {address} with sub-parts). Composite attributes are written in parentheses and multivalued ones in braces in textual notation, e.g. ALLOTTEE(allottee_id, name(first, middle, last), {phone}, date_of_birth).
02Relationships: degree, roles and recursion
A relationship is an association among entities — Bindu works on AI Lab. A relationship set (relationship type) is the set of all such associations of the same kind, drawn as a diamond joined by lines to the participating entity sets. Its degree is the number of participating entity sets.
Degree
Name
Example
1
Unary (recursive)
EMPLOYEE supervises EMPLOYEE — the same entity set plays two roles, supervisor and subordinate
2
Binary
EMPLOYEE works_for DEPARTMENT — the most common case
3
Ternary
SUPPLIER supplies PART to PROJECT, with attribute quantity
n
n-ary
Any number of entity sets in one relationship
Relationships can have attributes too. In WORKS_ON between EMPLOYEE and PROJECT, hours belongs to neither an employee (she works different hours on each project) nor a project (each project has many workers) — it describes the pair, so it is an attribute of the relationship. That is exactly why the sample table works_on(emp_id, proj_id, hours) exists.
Watch out
A ternary relationship is not the same as three binary ones. 'Supplier S supplies part P to project J' cannot always be rebuilt from 'S supplies P', 'S supplies J' and 'J uses P' — the binary facts lose which combination actually happened.
03Structural constraints: cardinality and participation
The cardinality ratio (mapping cardinality) of a binary relationship gives the maximum number of relationship instances an entity can take part in. Participation gives the minimum: whether every entity must take part (total, drawn as a double line, also called existence dependency) or may stay out (partial, a single line).
Ratio
Meaning
Example
1:1
An entity on either side relates to at most one on the other
DEPARTMENT managed_by EMPLOYEE (one manager per department, one department per manager)
1:N
One entity on the '1' side relates to many on the 'N' side, each of which relates to at most one
DEPARTMENT has EMPLOYEEs; EMPLOYEE supervises EMPLOYEEs
M:N
Many on each side
EMPLOYEE works_on PROJECT
Cardinality ratios of binary relationships
The (min, max) notation states both constraints at once. A pair (min, max) written on the line between entity set E and relationship R means each entity of E takes part in at least min and at most max instances of R. min = 0 means partial participation; min ≥ 1 means total participation; max = N means no upper limit.
EMPLOYEE ——(0,1)—— < WORKS_IN > ——(0,N)—— DEPARTMENT
(0,1) at EMPLOYEE : an employee works in at most one department, possibly none (Jose)
(0,N) at DEPARTMENT: a department has any number of employees, possibly none (Operations)
⇒ cardinality ratio DEPARTMENT : EMPLOYEE = 1 : N, partial participation on both sides
Reading (min, max) on the sample data
Watch out
Placement differs between notations. Chen writes DEPARTMENT —1— WORKS_IN —N— EMPLOYEE, with the N next to EMPLOYEE (read across the diamond: 'one department, N employees'). (min, max) writes the employee's own limit (0,1) next to EMPLOYEE — the opposite side. Korth's diagrams instead draw an arrow towards the 'one' side.
04Chen notation: the symbols
Symbol
Meaning
Rectangle
Strong (regular) entity set
Double rectangle
Weak entity set
Ellipse (oval)
Attribute
Ellipse with the name underlined
Key attribute
Ellipse with a dashed underline
Partial key (discriminator) of a weak entity set
Double ellipse
Multivalued attribute
Dashed ellipse
Derived attribute
Ellipses connected to an ellipse
Composite attribute and its components
Diamond
Relationship set
Double diamond
Identifying relationship of a weak entity set
Single line
Links attributes to entities, and entity sets to relationships (partial participation)
Double line
Total participation of an entity set in a relationship
1, N, M on lines
Cardinality ratio
Triangle labelled ISA / circle with d or o
Specialization or generalization (EER)
Chen notation cheat sheet
Other notations exist. Crow's-foot (Information Engineering) notation, common in CASE tools, draws relationships as plain lines: a three-pronged 'crow's foot' means many, a bar means one and a circle means zero (optional). UML class diagrams write multiplicities such as 0..1 and 1..* at the line ends.
PSC favourite
Symbol questions appear in almost every paper: attribute = ellipse, entity set = rectangle, relationship = diamond, weak entity = double rectangle, identifying relationship = double diamond, multivalued = double ellipse, derived = dashed ellipse, total participation = double line.
05Weak entity sets
A weak entity set has no key of its own: its entities can be told apart only within the context of a related owner (identifying) entity. Example: an employee's DEPENDENTs (children, spouse) are identified by their name only among that employee's dependents — two employees may each have a child called Anu. Likewise INSTALMENT number 3 means something only for a particular ALLOTMENT.
The weak entity set is linked to its owner by an identifying relationship (double diamond), normally 1:N from owner to weak entity.
The weak entity set has total participation in the identifying relationship — every dependent belongs to some employee (existence dependency).
Its partial key (discriminator), drawn with a dashed underline, distinguishes weak entities that share the same owner — dependent_name, instalment_no, payment_no.
Its full key = owner's primary key + partial key, e.g. (emp_id, dependent_name).
Deleting the owner normally deletes its weak entities (ON DELETE CASCADE after mapping).
A strong entity set is simply one that does have a key of its own. Note that total participation alone does not make an entity weak: every EMPLOYEE may be required to work for a department and still be identified by emp_id.
06Extended E-R: specialization, generalization and aggregation
The extended (enhanced) E-R model adds class hierarchies. A superclass such as EMPLOYEE has subclasses such as ENGINEER, SECRETARY and TECHNICIAN; each subclass entity is a superclass entity (the ISA relationship) and inherits all its attributes and relationships while adding its own (an engineer has engineering_type, a secretary has typing_speed).
Specialization (top-down)
Start from one entity set and define subclasses
EMPLOYEE → ENGINEER, SECRETARY, TECHNICIAN
Driven by attributes or relationships that only some entities have
Generalization (bottom-up)
Start from several entity sets and extract their common features
CAR, TRUCK → VEHICLE
Driven by shared attributes (registration_no, price)
Constraint
Options
Notation and example
Disjointness
Disjoint (d): an entity belongs to at most one subclass. Overlapping (o): it may belong to several
A vehicle is a car or a truck (d); a person may be both STUDENT and EMPLOYEE (o)
Completeness
Total: every superclass entity must be in some subclass (double line). Partial: some belong to none (single line)
Every account is SAVINGS or CURRENT (total); not every employee is an ENGINEER/SECRETARY/TECHNICIAN (partial)
Definition
Predicate (attribute)-defined: membership decided by a superclass attribute, the defining attribute or subtype discriminator. User-defined: assigned by users
job_type = 'Engineer' puts an employee in ENGINEER
The four combinations disjoint/overlapping × total/partial are all possible
A subclass with more than one superclass is a shared subclass (multiple inheritance), turning the hierarchy into a lattice; a subclass of entities drawn from different superclasses (an OWNER who may be a PERSON, a BANK or a COMPANY) is a union type or category.
Aggregation lets a relationship take part in another relationship. If a supervisor monitors each (employee, project) assignment, MONITORS must relate to WORKS_ON itself, not to EMPLOYEE or PROJECT separately. Aggregation draws a box around WORKS_ON and its entity sets and treats it as a higher-level entity that MONITORS can link to — avoiding a clumsy ternary relationship.
07Mapping an E-R diagram to relations
Every E-R construct has a standard translation (Navathe's mapping algorithm). Applying it to a company diagram — DEPARTMENT, EMPLOYEE, PROJECT, a recursive SUPERVISES, a 1:N HAS, a 1:N CONTROLS and an M:N WORKS_ON with hours — produces exactly the sample schema used throughout this module.
Mapping rules
Strong entity set
One relation with all simple attributes; composite attributes contribute only their simple components; derived attributes are usually dropped (computed in a view). Choose one key as primary key. DEPARTMENT → dept(dept_id, dname, location).
Weak entity set
One relation with its own attributes plus the owner's primary key as a foreign key; primary key = owner key + partial key; usually ON DELETE CASCADE. DEPENDENT → dependent(emp_id, dep_name, relation, birth_date).
Binary 1:N
Put the primary key of the '1' side as a foreign key in the 'N' side relation, together with any relationship attributes. HAS → emp.dept_id; SUPERVISES (recursive) → emp.manager_id; CONTROLS → project.dept_id.
Binary 1:1
Foreign-key approach: add the other side's key to the relation whose entity has total participation (fewer NULLs), declared UNIQUE. Merged-relation approach when both sides are total. MANAGED_BY → dept.mgr_id UNIQUE, dept.mgr_start.
Binary M:N
A new relation holding both primary keys as foreign keys plus relationship attributes; its primary key is the combination. WORKS_ON → works_on(emp_id, proj_id, hours).
Multivalued attribute
A new relation (owner key, value), both together forming the key. EMPLOYEE.{phone} → emp_phone(emp_id, phone).
n-ary relationship
A new relation with foreign keys to all participants plus attributes; the key is usually all foreign keys (an entity with cardinality 1 may be left out of the key). SUPPLY → supply(sup_id, part_id, proj_id, quantity).
Specialization / generalization
8A: superclass table + one table per subclass (works always). 8B: subclass tables only, each with inherited attributes (total specialization). 8C: one table with a type attribute (disjoint; NULLs for others' attributes). 8D: one table with boolean flags per subclass (overlapping).
SQLThe company diagram mapped to tables (runs on SQLite)
'Minimum number of tables' questions assume every entity becomes a table and ask how many relationships can be absorbed into entity tables as foreign keys. The rules follow directly from the mapping steps.
Construct
Minimum tables
Reason
Binary M:N between two strong entities
3
Neither side can hold a single foreign key, so the relationship needs its own table
Binary 1:N (or N:1)
2
The relationship folds into the N-side table as a foreign key
Binary 1:1, partial participation on both sides
2
Fold into either side as a foreign key (with NULLs)
Binary 1:1, total participation on both sides
1
Both entities and the relationship merge into one table
Weak entity + identifying relationship + owner
2
The identifying relationship folds into the weak entity's table
Unary 1:N (recursive)
1
A self-referencing foreign key (manager_id)
Unary M:N (e.g. course prerequisite)
2
Entity table + a table of (course, prerequisite) pairs
Each multivalued attribute
+1
Always a separate table
Counting tables
Watch out
Conventions differ for a 1:1 relationship with total participation on only one side. GATE-style solutions (e.g. GeeksforGeeks) merge it into 1 table, keyed by the totally participating side; Navathe recommends the merged relation only when both sides are total and otherwise uses 2 tables. Read the options: if both 1 and 2 appear, the question usually follows the GATE convention.
Worked count: entity sets A, B, C; A–B is M:N; B–C is 1:N with C on the N side; C has one multivalued attribute. Tables: A, B, C (3) + the M:N relationship (1) + the multivalued attribute (1) = 5; the 1:N relationship is absorbed into C.
Worked examples
Try the problem first, then reveal the working one step at a time.
EX 1Mapping a company diagram step by step
Map this E-R design to relations: DEPARTMENT(dept_id, dname, location); EMPLOYEE(emp_id, ename, job, salary, hire_date, {phone}); PROJECT(proj_id, pname, budget); DEPARTMENT 1:N EMPLOYEE (HAS); EMPLOYEE 1:N EMPLOYEE (SUPERVISES, roles manager/subordinate); DEPARTMENT 1:N PROJECT (CONTROLS); EMPLOYEE M:N PROJECT (WORKS_ON, attribute hours); weak entity DEPENDENT(dep_name, relation) owned by EMPLOYEE.
EX 2Minimum number of tables
STUDENT(roll, name, {phone}) and COURSE(cid, title) are related by ENROLLS (M:N, attribute grade). DEPT(did, dname) is related to STUDENT by BELONGS (1:N, every student belongs to exactly one department). What is the minimum number of tables?
EX 3Choosing a mapping for a specialization
Choose the best relational mapping and justify: (a) VEHICLE(reg_no, price) specialised into CAR(seats) and TRUCK(tonnage); every vehicle is exactly one of the two. (b) PERSON(pid, name) specialised into STUDENT(course) and EMPLOYEE(salary); a person may be both, or neither.
Practice session
Work each problem on paper first, then check. Marking one solved earns 10 XP.0/5 solved
Q1
SUPPLIER(sid), PART(pid) and PROJECT(jid) take part in a ternary relationship SUPPLY with attribute quantity. Write the relation for SUPPLY and its primary key. How would the key change if each (supplier, project) pair could involve only one part?
Q2
Entity sets E1, E2 and E3: E1–E2 is a 1:1 relationship with partial participation on both sides; E2–E3 is M:N; E3 has one multivalued attribute. What is the minimum number of tables?
Q3
Classify each attribute of an allottee: (a) age, (b) address with house, street, city and PIN, (c) phone numbers, (d) Aadhaar number, (e) middle name, (f) date of allotment of the house.
Q4
LOAN(loan_no, amount) owns the weak entity PAYMENT(payment_no, pay_date, pay_amount). Draw the symbols you would use and write the relation for PAYMENT with its key.
Q5
Map two unary relationships: (a) EMPLOYEE supervises EMPLOYEE (each employee has at most one supervisor); (b) COURSE is_prerequisite_of COURSE (a course may have many prerequisites and be a prerequisite of many courses). How many tables in total does each design need?
'Cardinality ratio' (1:1, 1:N, M:N) in E-R is different from the cardinality of a relation (its number of rows).
A weak entity has a partial key (discriminator), not a primary key; after mapping its key is owner's PK + partial key. 'Discriminator' is also used in EER for the superclass attribute that decides the subtype.
In Chen notation the N sits next to the entity on the 'many' side; (min, max) pairs are written next to the entity they constrain — the opposite placement. Korth draws arrows towards the 'one' side.
Minimum-table conventions differ for 1:1 with total participation on just one side (GATE: 1 table; Navathe: merge only when both sides are total).
Attributes of a 1:1 or 1:N relationship may migrate into an entity's table; attributes of an M:N relationship must stay with the relationship's own table.
Quiz — KPSC style
12 questions. 70 % passes the topic quiz (+30 XP, +20 more for 100 %). Exam scoring: +1 correct, −⅓ wrong.
The E-R model & mapping to relations · Question 1 of 12✓ 0 · ✗ 0
In Chen's E-R notation, a weak entity set is drawn as a:
Past-paper questions on this topic
Modelled on real KPSC questions (reworded) with the same concept and answer; each links to its original paper.
Past papers · Question 1 of 13✓ 0 · ✗ 0
Modelled on QP 088/2023 · Assistant Professor in Computer Science and Engineering (23 Jun 2023), Q.59 (reworded)original paper (PDF)
In an E-R diagram, how is an identifying relationship drawn?