DBMS slides 📂 Introduction · 3 of 11 44 min read

Entity-Relationship (ER) Model in DBMS: ER Diagram, Entities, Attributes & Keys

A 20-slide visual guide to Entity-Relationship modelling — the blueprint phase of database design. It covers the three building blocks, Chen notation, entity sets, all six attribute types, the key hierarchy, relationship degree and cardinality, participation, weak entities, and converting an ER diagram into tables, all with animated Chen-notation diagrams.

📐

The Entity-Relationship (ER) Model

The blueprint phase of database design — entities, attributes, relationships, keys, cardinality, weak entities, and turning an ER diagram into real tables.
Chen Notation Keys & Hierarchy Relationships ER → Tables

Press Next → or use ← → arrow keys

Section 01

The Story — The Architect's Blueprint

Draw it before you build it
No architect pours concrete before drawing a blueprint — rooms as boxes, connections as lines. Database designers do exactly the same: they draw an Entity-Relationship Diagram before creating a single table. It shows what data the organization needs and how the pieces relate — with no knowledge of any specific DBMS required.
💡
Core Definition (Peter Chen, 1976)

The ER model is a high-level, conceptual data model. It's the blueprint of a database: cheap to draw, cheap to change, and impossible to skip if you want a clean design.

🗣️
The Grammar of Data

Entities are the nouns (Student, Course, Doctor), relationships are the verbs (enrols in, teaches, treats), and attributes are the adjectives that describe them (name, age, salary).

Section 02

The Three Building Blocks

Name Attribute (adjective) · ellipse STUDENT Entity (noun) · rectangle enrols Relationship (verb) · diamond COURSE Entity (noun) · rectangle
Entity
rectangle
A distinctly identifiable real-world object or concept — physical (a person) or conceptual (a course).
Attribute
ellipse
A property that describes an entity — Roll No, Name, Age. Attributes eventually become table columns.
Relationship
diamond
An association between two or more entities — Student enrols in Course; Customer owns Account.
Section 03 · Cheat Sheet

The ER Notation Legend (Chen)

ElementSymbolMeaning
Entity▭ RectangleA "thing" we store data about
Weak Entity▭▭ Double rectangleCannot exist alone
Attribute⬭ EllipseA property of an entity
Key Attribute Underlined ellipseUniquely identifies the entity
Multivalued◎ Double ellipseHolds multiple values
Derived⬭ Dashed ellipseComputed from other attributes
Relationship◇ DiamondAssociation between entities
Identifying Rel.◈ Double diamondIdentifies a weak entity
Partial Participation— Single lineOptional participation
Total Participation═ Double lineMandatory participation
Section 04

Entity vs Entity Set

ConceptDefinitionCorresponds to
EntityA single specific instance — student Aman, Roll 101One row
Entity SetThe collection of all entities of the same type — STUDENTThe whole table
✏️
Diagram Rule

In ER diagrams, rectangles are labelled with entity-set names (STUDENT), never individual names. Individuals live in the data, not the diagram.

🧠
Memory Hook

Entity Set = Table  •  Entity = Row  •  Attribute = Column.

Section 05

The Six Attribute Types

Simple (Atomic)
Cannot be divided further.
Gender · Age
⬭↳
Composite
Splits into smaller parts.
Name → First + Last
Single-valued
Holds exactly one value.
Date_of_Birth · ISBN
Multivalued
Holds many values — double ellipse.
Phone_No · Email
Derived
Computed from others — dashed ellipse.
Age (from DOB)
🔑
Key
Uniquely identifies — underlined.
Roll_No · Emp_ID · SKU
Section 05 · Distinctions

Composite vs Multivalued (and NULL)

🧩
Composite = one value, many parts
One Address = House No + Street + City + State + PIN. One DOB = Day + Month + Year. Store only the leaf parts as columns — that's what lets you search "all customers in one city" or sort by surname.
📚
Multivalued = many separate values
Many values of the same kind — two phone numbers, three emails, several hobbies. If a person can have a mobile and a landline, Phone_No must be a double ellipse.
⚖️
NULL vs Multivalued

A NULL is missing data — one value that isn't there yet. A multivalued attribute holds several values at once. They are not the same thing.

Section 06

Keys — Guaranteeing Uniqueness

When two students are both "Rahul Sharma", queries return the wrong row. Keys guarantee every query lands on exactly one row. They nest:

SUPER KEY — any set that identifies (may carry extras) {Roll_No, Name} · {Roll_No, Age} CANDIDATE KEY — minimal super key {Roll_No} · {Email} · {Aadhaar_No} PRIMARY KEY Roll_No 🔑
🔑
The Hierarchy

Every primary key ⊆ candidate key ⊆ super key. The designer picks the best candidate as primary; the leftover candidates become alternate keys.

Section 06 · Reference

Every Key Type at a Glance

KeyDefinitionExample (STUDENT)
Super KeyAny attribute set that uniquely identifies a row (extras allowed){Roll_No}, {Roll_No, Name}
Candidate KeyA minimal super key — remove any part and uniqueness is lost{Roll_No}, {Email}, {Aadhaar_No}
Primary KeyThe one candidate key chosen to identify rowsRoll_No
Alternate KeyCandidate keys not chosen as primaryEmail, Aadhaar_No
Composite KeyA key made of two or more attributes together{Course_ID, Section}
Foreign KeyAttribute referencing another table's primary keyDept_ID → DEPARTMENT
🧩
Composite ≠ Compound Confusion

A composite key needs all its attributes together to be unique — like (Roll_No, Course_ID) in an enrolment table.

Section 07

Relationships & Their Degree

EMPLOYEE manages Unary (degree 1) self / recursive STUDENT enrols COURSE Binary (degree 2) ~95% of all cases DOCTOR PATIENT DRUG prescribes Ternary (degree 3)
🔗
Degree = How Many Entity Sets a Relationship Connects

Unary links a set to itself (Employee manages Employee). Binary connects two — the workhorse of design. Ternary ties three at once (Doctor prescribes Drug to Patient). Relationships can also carry their own attributes, like grade or enrolment date.

Section 07 · Cardinality

Cardinality — How Many?

EMPLOYEE 11 DESK One-to-One — each employee, one desk DEPARTMENT 1N EMPLOYEE One-to-Many — one dept, many staff STUDENT MN COURSE Many-to-Many — needs a junction table
🎯
Cardinality ≠ Participation

Cardinality (1, N, M) answers "how many?" Participation (single vs double line) answers "is it mandatory?" — they're independent. A relationship can be 1:N and total at once.

Section 08

Participation — Optional or Mandatory?

—  single line
Partial Participation
"it is optional"
Some entities may not take part. Not every Employee manages a department — so the Employee↔manages line is single.
═  double line
Total Participation
"it is mandatory"
Every entity must take part. Every Loan must belong to a Customer — so the Loan↔belongs-to line is double.
📋
It's a Business Rule

Total participation encodes a business fact: a loan with no customer is meaningless, so the connection is mandatory. The diagram simply records the rule.

Section 09

Strong & Weak Entities

"Room 101" is ambiguous — every floor and branch has one. Only "Room 101 of the Mumbai Taj" is unique. Room is weak (depends on Hotel); Hotel is strong.

LOAN Loan_No STRONG · single rectangle own primary key PAYS PAYMENT Payment_No WEAK · double rectangle partial key (dashed) · total participation
🏨
Three Signs of a Weak Entity

1) Drawn as a double rectangle · 2) Connected to its owner by a double-diamond identifying relationship with total participation · 3) Its dashed partial key becomes unique only when combined with the owner's primary key. Full identifier: Loan_No + Payment_No.

Section 10

Putting It Together — A Mini University ER

Roll_No Name STUDENT ENROLS Grade M N COURSE Course_ID Title
🎓
Reading the Diagram

Many STUDENTs ENROL in many COURSEs, and each enrolment records a Grade. A textbook M:N relationship with a descriptive attribute — note the grade sits on the diamond, not on either entity.

Section 11

From ER Diagram to Tables — 7 Rules

#RuleApplication
1Strong entity → its own table; key becomes primary keySTUDENT(Roll_No PK, …)
2Composite attribute → store only the leaf parts as columnsName → First_Name, Last_Name
3Multivalued attribute → separate table linked by the entity's keyPhone_No gets its own table
4Derived attribute → usually not stored; computed on demandAge from DOB
51:N → put the "one" side's PK as a foreign key on the "many" sideNo new table needed
6M:N → new junction table holding both keys + descriptive attributesENROLS(Roll_No, Course_ID, Grade)
7Weak entity → table whose PK = owner's key + partial keyLoan_No + Payment_No
Section 11 · Example

The University Diagram, as Tables

-- Rule 1: strong entities → their own tables
CREATE TABLE STUDENT (
    Roll_No   INTEGER PRIMARY KEY,
    Name      TEXT,
    Gender    TEXT
);
CREATE TABLE COURSE (
    Course_ID TEXT PRIMARY KEY,
    Title     TEXT
);

-- Rule 6: the M:N relationship becomes a junction table
CREATE TABLE ENROLS (
    Roll_No   INTEGER REFERENCES STUDENT(Roll_No),
    Course_ID TEXT    REFERENCES COURSE(Course_ID),
    Grade     TEXT,                       -- relationship attribute
    PRIMARY KEY (Roll_No, Course_ID)      -- composite key
);
🔗
Why the Junction Table Matters

An M:N relationship has nowhere to store Grade in either entity's table. The junction table gives it a home — one row per (student, course) pair. If you can't find a home for a relationship's attribute, you've found a missing junction table.

Section 12

Three Common Mistakes to Avoid

🔤
Verb as an entity
"Purchase" sounds like a thing but is usually a relationship between Customer and Product. Ask: does it have independent identity, or does it only exist because two entities met?
Forgetting the key underline
An attribute ellipse with no underline is just data. Examiners deduct marks. Every strong entity needs exactly one underlined key.
🔀
Cardinality vs participation
Cardinality (1, N, M) = "how many?" Participation (single/double line) = "is it mandatory?" They're independent — a relationship can be 1:N and total together.
🧭
The Test for an Entity

If a candidate "thing" only exists because two other entities came together, it's a relationship, not an entity.

Section 13 · Part 1

Golden Rules of ER Modelling — 1 to 4

🏆 NON-NEGOTIABLE RULES · 1–4
1
Map the language. Nouns are entities, verbs are relationships, adjectives are attributes. Write the requirement as a sentence first, then translate it shape by shape.
2
Every strong entity has exactly one underlined primary key. No key means it's either a weak entity or a modelling error.
3
Label rectangles with entity-set names, never individuals. Draw STUDENT, not "Aman" — individuals belong in the data, not the diagram.
4
Decide cardinality and participation separately. First ask "how many?" (1, N, M), then ask "is it mandatory?" (single vs double line).
Section 13 · Part 2

Golden Rules of ER Modelling — 5 to 7

🏆 NON-NEGOTIABLE RULES · 5–7
5
A weak entity always needs three things together: a double rectangle, a double-diamond identifying relationship, and a dashed partial key.
6
Descriptive data about a relationship goes on the diamond — not on either entity. A grade belongs to ENROLS, not to STUDENT or COURSE alone.
7
Every M:N relationship becomes its own table. If you can't find a home for a relationship's attribute, you've found a missing junction table.
🧵
The Thread

ER modelling is the cheap, erasable blueprint stage. Get the nouns, verbs and adjectives right on paper, and the tables almost write themselves.

FINAL

The Blueprint, Complete

3Building blocks
6Attribute types
6Key types
3Degrees of relationship
7ER → table rules
1976Chen's ER model
🎯
The Foundation Is Set

You can now read and draw an ER diagram, tell strong from weak entities, choose the right key, distinguish cardinality from participation, and convert any diagram into clean tables. Next comes turning these tables into well-formed schemas — keys in depth, functional dependencies and normalization.

🧠
One Sentence to Remember

Nouns become rectangles, verbs become diamonds, adjectives become ellipses — underline the one that's unique, double the one that's weak, and every M:N gets its own table.

📐 End of tutorial · Press to review, or click Restart