DBMS slides 📂 Introduction · 2 of 11 44 min read

Data Models in DBMS: Hierarchical, Network, Relational & the Three-Schema Architecture

An 18-slide visual guide to how databases are structured. It walks through the hierarchical, network and relational data models, the ANSI/SPARC three-schema architecture and its two mappings, and logical vs physical data independence — with animated tree, graph, architecture and shield diagrams plus a live SQLite demo.

🧬

Data Models & Three-Schema Architecture

Hierarchical, Network and Relational models, the ANSI/SPARC three-schema architecture, and the data independence that lets a database evolve for decades without breaking a single program.
3 Data Models Three Schemas Data Independence Schema vs Instance

Press Next → or use ← → arrow keys

Section 01

The Story — Three Ways to Draw One Family

Same relatives, three very different drawings
Cousin A draws a family tree — one ancestor on top, everyone with exactly one parent. Clean, but it can't show a relationship from two sides.
Cousin B draws a web of arrows — people linked in every direction. It captures the complexity, but becomes a maze to navigate.
Cousin C draws a simple table — one row per person, columns for name, parent, spouse. Less pretty, but trivial to search and change.
💡
The Core Idea

A data model is not the data itself — it is the blueprint for how data is structured and related. The same facts modeled as a tree, a graph, or tables carry different consequences for decades.

Section 02

What Exactly Is a Data Model?

A data model = concepts to describe structure (data types, relationships, constraints) + operations to retrieve and update. Models sit at three levels of abstraction:

🧑‍💼
High-Level (Conceptual)
close to the user
Entities, attributes and relationships in business terms. Used during design, before storage. Example: ER model.
🗃️
Representational
close to the DBMS
Record-based, still human-readable, but maps to real DBMS structures. Relational, network, hierarchical.
💽
Low-Level (Physical)
close to the disk
Record formats, orderings, access paths, indexes. For system specialists — hidden from ordinary users.
🧭
This Tutorial's Focus

The three representational models — hierarchical, network and relational — and the architecture that wraps them for data independence.

Section 02 · Key Distinction

Schema vs Instance

TermWhat it isHow often it changes
SchemaThe database description — structure and rules; the blueprintRarely
InstanceThe actual data at a moment — the database stateEvery insert / update / delete
RelationshipOne schema supports infinitely many instances over time
🏗️
Blueprint vs Building

The schema is the architect's blueprint; the instance is who lives in the building today. Same blueprint, endless changes of residents.

Section 03

The Three Record-Based Models — A Map

🌳 HIERARCHICAL 1960s · tree of pointers 1 : N only 🕸️ NETWORK late 60s–70s · graph M : N pointers 📋 RELATIONAL 1970 → today · tables linked by values · SQL
🧵
One-Line Summary

Hierarchical = tree of pointers, Network = graph of pointers, Relational = tables linked by values. Pointers tie data to storage; values set it free.

Section 04

The Hierarchical Model — A Tree

🎓 University Dept: CSE Dept: ECE DBMS OS VLSI Signals Every child has exactly ONE parent · access always starts at the root
✅ Strengths
Simple & fast for 1:N, auto parent–child integrity, ideal for tree-shaped data (org charts, file systems, XML).
❌ Weaknesses
Rigid — no natural M:N. A child can't have two parents without duplicating data. Structure changes force rewrites.
🏛️ Real Example
IBM IMS, built for NASA's Apollo program — still running in some banks today.
Section 05

The Network Model — A Graph

COURSES (owners) STUDENTS (members) C1: DBMS C2: OS S1: Riya S2: Aman S3: Neha One student links to several courses · one course links to many students — M:N directly
✅ Strengths
Models M:N directly, fast pointer navigation, less redundancy than hierarchical, powerful for interconnected data.
❌ Weaknesses
A pointer maze — programs navigate record-by-record. Almost no data independence; structure changes break programs.
🏛️ Real Example
The CODASYL DBTG standard and products like IDMS on mainframes.
Section 06

The Relational Model — Tables Linked by Values

In 1970, E. F. Codd proposed: forget pointers and trees — store everything as relations (tables), and express relationships through shared values.

STUDENT
roll 🔑namedept
1RiyaCSE
2AmanECE
3NehaCSE
ENROLL  roll → STUDENT.roll
roll 🔗coursegrade
1DBMSA
1OSB
3DBMSA
No Pointers, No Duplication

The M:N student–course relationship is expressed purely by matching ENROLL.roll to STUDENT.roll — the student's name is never copied. This is why relational dominated: simple tables, a rigorous set-theory foundation, declarative SQL, and the strongest data independence of the three.

Section 06 · Vocabulary

Core Relational Vocabulary

TermMeaningExample
RelationA tableSTUDENT
TupleA row — one instance(1, Riya, CSE)
AttributeA columnname
DomainAllowed values for an attributedept ∈ {CSE, ECE, …}
DegreeNumber of attributes (columns)3
CardinalityNumber of tuples (rows) now3
Primary KeyAttribute(s) uniquely identifying a tupleroll
Foreign KeyAttribute referencing a key in another relationENROLL.roll
📐
Degree vs Cardinality

Degree counts columns (fixed by the schema). Cardinality counts rows (changes with every insert or delete).

Section 07

Hierarchical vs Network vs Relational

PropertyHierarchicalNetworkRelational
StructureTreeGraphTables
Relationships1:N only1:N & M:N1:1, 1:N, M:N via keys
Links byPointersPointersMatching values
AccessNavigate from rootNavigate pointersDeclarative SQL
Data independenceVery lowLowHigh
RedundancyHighModerateControlled
Ease of useModerateHardEasy
Theory basisNoneNoneSet theory / algebra
SystemsIBM IMSIDMS, CODASYLMySQL, PostgreSQL, Oracle
Era1960sLate 60s–70s1970 → today
Section 08

The Three-Schema Architecture (ANSI/SPARC, 1975)

EXTERNAL LEVEL · user views 🧑‍💼 Clerk view name, seat 🧮 Accountant view name, fees 👩‍🏫 Faculty view name, grades ↑↓ external / conceptual mapping 🧩 CONCEPTUAL LEVEL · one community schema all entities, relationships & constraints — implementation-independent ↑↓ conceptual / internal mapping 💽 INTERNAL LEVEL · physical storage file organization, record layout, indexes, access paths A query on a view travels down through both mappings to the stored bytes — and results travel back up
🎛️
Three Levels, One Purpose

Many external views · one conceptual schema · one internal schema. Separating them is exactly what makes data independence possible.

Section 09

The Two Mappings & a Request's Journey

🔗
Mapping 1 — External / Conceptual
Connects each user view to the conceptual schema. Lets the DBMS rewrite a query on a view into a query on the full database.
🧭
Mapping 2 — Conceptual / Internal
Connects the conceptual schema to the internal storage schema. Lets the DBMS locate where the data actually resides on disk.
🧑‍💻
The User's View
Never sees any of this translation — they just query their view and get answers.
🚦 REQUEST JOURNEY THROUGH THE LEVELS
1User query on a view (external level)
2 · Map 1Rewritten into a query on the full database (conceptual)
3 · Map 2Translated to execution on the stored bytes (internal)
4Results mapped back up — the user never sees the translation
Section 10

Data Independence — The Whole Point

The capacity to change the schema at one level without changing the schema at the next higher level. Two shields deliver it:

EXTERNAL · user views & applications 🛡️ LOGICAL independence CONCEPTUAL · whole-database schema 🛡️ PHYSICAL independence INTERNAL · physical storage add column add index
Logical Independence
Change the conceptual schema without touching external views. Add an email column → old views still work. Harder to achieve.
Physical Independence
Change the internal schema without touching the conceptual schema. Add an index → queries just run faster. Common & easy.
🧠 Mnemonic
Logical shields against Logical (conceptual) changes; Physical shields against Physical (storage) changes. The level above never has to care.
Section 11

Schema vs Instance — A Concrete Look

SCHEMA · blueprint, rarely changes
STUDENT(roll, name, dept)
ENROLL(roll, course, grade)

# constraints
ENROLL.roll  STUDENT.roll   # FK
dept  {CSE, ECE, ME}
INSTANCE · data now, changes often
# STUDENT
(1, Riya, CSE)
(2, Aman, ECE)
(3, Neha, CSE)

# ENROLL
(1, DBMS, A) (1, OS, B) (3, DBMS, A)

# tomorrow: add a student →
# the schema above is unchanged
♾️
One Schema, Infinite Instances

The blueprint stays put while the data churns beneath it — insert, update, delete all day, and the schema never moves.

Section 12 · Hands-On

Relational Model & Independence in Python

A conceptual schema (tables), an external schema (a VIEW), then we prove both kinds of independence.

# CONCEPTUAL SCHEMA — the whole DB as relations
cur.executescript("""
  CREATE TABLE student(roll INTEGER PRIMARY KEY, name TEXT, dept TEXT);
  CREATE TABLE enroll(roll INTEGER, course TEXT, grade TEXT,
       FOREIGN KEY(roll) REFERENCES student(roll));
""")

# EXTERNAL SCHEMA — a view for CSE faculty (only what they need)
cur.execute("""CREATE VIEW cse_grades AS
   SELECT s.name, e.course, e.grade
   FROM student s JOIN enroll e ON s.roll = e.roll
   WHERE s.dept = 'CSE'""")

# LOGICAL independence: add a column the view never used
cur.execute("ALTER TABLE student ADD COLUMN email TEXT")   # view unaffected ✔

# PHYSICAL independence: add an index (pure storage choice)
cur.execute("CREATE INDEX idx_enroll_roll ON enroll(roll)") # results identical ✔
Output — the view is unchanged before & after both changes
CSE faculty view: ('Riya', 'DBMS', 'A') ('Riya', 'OS', 'B') ('Neha', 'DBMS', 'A')
What Was Proven

Adding a column (a conceptual change) didn't break the view → logical independence. Adding an index (an internal change) didn't alter results → physical independence. The three-schema architecture made both possible.

Section 13 · Part 1

Key Takeaways — Rules 1 to 4

🏆 THE GOLDEN RULES · 1–4
1
A data model is a blueprint. It describes structure, relationships, constraints and operations — ranging from high-level (ER) to representational (relational, network, hierarchical) to low-level (physical).
2
Hierarchical = a tree. 1:N only, navigate from the root. Simple but rigid — no M:N without duplication. Example: IBM IMS.
3
Network = a graph. Owner–member sets support M:N, but it's a complex pointer maze with poor data independence. Example: CODASYL / IDMS.
4
Relational = tables linked by values. Rigorous math basis, declarative SQL, strongest data independence — it dominates today (Codd, 1970).
Section 13 · Part 2

Key Takeaways — Rules 5 to 7

🏆 THE GOLDEN RULES · 5–7
5
Three-schema architecture separates external (user views), conceptual (whole DB) and internal (storage) levels, glued by two mappings — the engine of data independence.
6
Data independence, two flavours. Logical: change the conceptual schema without breaking external views. Physical: change storage without touching the conceptual schema.
7
Schema vs instance. The schema is the blueprint (changes rarely); the instance is the data right now (changes constantly). One schema supports infinitely many instances.
🧵
The Thread

Pointers tie data to storage; values set it free. Layer three schemas over those values and the database can evolve for decades without endless rewrites.

FINAL

Why Cousin C Sleeps Soundly

Values below, three layers above — nothing breaks
Cousin A's tree and Cousin B's web hard-wired relationships into pointers — change the structure and every program shatters. Cousin C's tables linked data by values, and the three-schema architecture wrapped those tables in three abstraction layers. Accountant, clerk and faculty each get their own external view; the organization keeps one conceptual schema; the DBA tunes internal storage freely. Column added, index built, disk swapped — nobody's program breaks.
3Record-based models
3Schema levels
2Mappings
2Kinds of independence
1970Codd's relational model
🎓
The Foundation Is Set

This quiet resilience is the modern database. Everything next — ER modelling, keys and normalization, relational algebra and SQL — builds directly on data models, the three-schema architecture and data independence.

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