DBMS slides 📂 Introduction · 1 of 11 43 min read

Introduction to Databases: DBMS vs File Systems, Characteristics, Advantages & Disadvantages

A beginner-friendly, 16-slide walkthrough of why databases exist. It contrasts messy file-based systems with the DBMS approach, breaks down redundancy, inconsistency and concurrency problems, then covers DBMS characteristics, advantages, disadvantages, a live SQLite demo and key takeaways.

🗄️

Introduction to Databases

Why databases exist, how a DBMS beats the old file-based world, and the characteristics, advantages and disadvantages every developer must know — the foundation the entire field is built on.
DBMS vs File System Characteristics Pros & Cons Hands-On SQL

Press Next → or use ← → arrow keys

Section 01

The Story — A Tale of Two Colleges

One student, three notebooks that disagree
In College A, three offices keep their own records: Hostel stores names and room numbers, the Library tracks borrowed books, and Exams records marks. When Riya changes her surname, only Hostel updates its notebook — Library and Exams never find out. Now three records contradict each other.

College B does it differently: all three offices read and write one shared record. Change Riya's name once, and every office instantly sees the truth — no duplicates, no contradictions.
💡
The Core Idea

A DBMS exists to let many users and programs share the same data safely — without duplication, contradiction, or data loss — while hiding the messy details of how that data is physically stored.

Section 02

Vocabulary — Data, Database, DBMS

🔢
Data
raw facts
Recorded facts with implicit meaning — the number 21, the name Riya, the date 2025-08-14.
📚
Database
organized collection
A structured, related collection of data that models part of the real world for a specific purpose and audience.
⚙️
DBMS
the software
Software to define, create, query, update and administer the database — MySQL, PostgreSQL, Oracle, SQLite, MongoDB.
🥛
Memory Aid

Data is the milk. The database is the bottle that organizes and holds it. The DBMS is the fridge that keeps it safe. Database + DBMS together = a Database System.

Section 03

The Old World — File-Based Systems

Before the 1970s, applications stored data in their own flat files. Four habits defined that world:

🗃️ HOW FILE-BASED SYSTEMS OPERATED
1
Each program owns its own files. Payroll keeps payroll files, HR keeps HR files — nothing is shared between applications.
2
File structure is hard-coded. Field order, widths and types live inside the program's source code, gluing program and data together.
3
The same data is copied everywhere. An employee's name and address sit in Payroll and HR and Insurance — three copies, maintained by hand.
4
Change one format → rewrite the program. Adding a single field means editing, recompiling and testing every program that touches that file.
⛓️
The Fundamental Weakness

In a file-based system, data and the programs that use it are inseparable. There is no central manager, no shared definition of what the data means, and no protection against two programs corrupting the same file at once.

Section 03 · Diagram

How Data Is Organized — Files vs DBMS

❌ FILE-BASED SYSTEM ✅ DBMS APPROACH 💼 Payroll 🗄️ 👥 HR 🗄️ 🛒 Sales 🗄️ Same data copied 3× → redundancy & drift 💼 Payroll 👥 HR 🛒 Sales 🗄️ One Database One shared source of truth → update once
🔀
Same Data, Two Architectures

On the left, each app hoards its own copy — so the same fact is stored three times and drifts out of sync. On the right, every app reads and writes one database: change it once, and everyone sees the change.

Section 04

Nine Problems With File-Based Systems

📑
Data Redundancy
stored many times
The same fact lives in Payroll, HR and Insurance files — wasting storage, every copy edited separately.
⚠️
Data Inconsistency
copies disagree
Update one address and forget the others → conflicting records for the same person.
🧩
Data Isolation
scattered formats
Data in many files and formats makes combining it slow, manual and error-prone.
🚫
Integrity Problems
rules per program
"Age must be positive" lives inside each program. One buggy app writes garbage others trust.
💸
Atomicity Failures
half-done writes
Debit A; power fails before crediting B. Money vanishes — there is no rollback.
🔄
Concurrency Anomalies
lost updates
Two programs edit one file at once and overwrite each other. Last writer wins, silently.
🔓
Weak Security
coarse permissions
File permissions can't restrict a clerk to viewing salaries at row or column level.
🔧
Hard Maintenance
no independence
Changing a file layout forces a rewrite of every program that reads it.
No Standard Query
custom code each time
Every new question ("who joined after 2020?") needs a brand-new program — no SQL.
Section 05

DBMS vs File System — Full Comparison

AspectFile-Based SystemDBMS
Data redundancyHigh — copies everywhereControlled via normalization
Data consistencyEasily contradictoryEnforced by constraints
Data sharingDifficult, file-by-fileBuilt-in, multi-user
QueryingCustom code each timeStandard SQL
Data independenceNone — tightly coupledLogical & physical
Integrity rulesBuried in each programCentral, declarative
Concurrency controlAbsent — lost updatesLocking / MVCC
Crash recoveryManual, often impossibleTransactions + logs
Security granularityCoarse file permissionsPer-user / table / column
Setup costVery lowHigher — software + skills
Best forTiny, single-user dataShared, mission-critical data
⚖️
Key Insight

A DBMS is not automatically "better" for everything. For a tiny, single-user, one-off task, a plain file is simpler and cheaper.

Section 06

Characteristics of the Database Approach

🗂️
Self-Describing
The database stores its own structure in a catalog (metadata). The DBMS reads the catalog to understand any database.
🧱
Program–Data Independence
Change how data is stored (add an index, split a table) without touching applications. This is data abstraction.
👁️
Multiple Views
A clerk sees names and seats; an accountant sees payments. One database, many custom views hiding the rest.
🤝
Sharing & Transactions
Concurrency control and transactions keep every user's view correct — even with hundreds reading and writing at once.
🛡️
Enforced Integrity
Keys and checks are declared once, centrally — no program can sneak in bad data.
♻️
Built-in Protection
Authorization controls what each user may do; recovery restores a consistent state after crashes.
🎯
Key Takeaway

The database approach means data is self-describing, shared, independent of programs and centrally protected — everything a pile of files can never be.

Section 06 · Diagram

Where the DBMS Sits — The Central Gatekeeper

🧑‍💻 App / User A 👩‍💼 App / User B 🧑‍🔧 App / User C DBMS ENGINE 🔍 QueryProcessor 🔒 Security& Auth 🔀 Concurrency ♻️ Recovery 🗄️ Stored Database 📋 + Metadata catalog
🚪
The Chokepoint Principle

No program touches raw disk directly — every request flows through the DBMS. That single chokepoint is exactly what makes data independence, security and concurrency control enforceable.

Section 07

Advantages of a DBMS

📉
Controlled Redundancy
Data stored once and referenced, not copied — removing the root cause of inconsistency.
normalization · foreign keys
Consistency & Integrity
Central constraints guarantee every program sees identical, correct data under the same rules.
PRIMARY KEY · CHECK · FK
🔎
Powerful Querying
Ask any question in standard SQL in seconds — no new program to write, compile and debug.
SELECT … JOIN … WHERE
🧱
Data Independence
Change physical storage or logical structure without rewriting applications.
logical + physical
👨‍👩‍👧‍👦
Concurrent Access
Thousands of users read and write at once, each transaction kept correct and isolated.
locking · MVCC · ACID
🔐
Security & Recovery
Fine-grained access control plus automatic backup and crash recovery protect against people and disasters.
GRANT/REVOKE · logs
Section 08

Disadvantages of a DBMS

💰
High Cost
licenses + hardware
Enterprise licenses, powerful hardware and skilled administrators all demand real investment.
🧠
Complexity
expertise required
Designing, tuning and securing a database needs skill. Poor design can be worse than no database.
🧑‍💼
Needs a DBA
dedicated role
Larger systems need a Database Administrator for backups, performance and security.
🐘
Overhead for Small Tasks
overkill
For a tiny, single-user, throwaway job a full DBMS is excessive machinery — a flat file is simpler.
💥
Single Point of Failure
centralized risk
Centralize everything and, if the database goes down, every dependent application stops at once.
📈
Learning Curve
SQL + modeling
Teams must learn SQL, data modeling and each DBMS's quirks before becoming productive.
Section 09

When Is a Plain File Actually Fine?

🗄️ Reach for a DBMS when…
  • Data is shared by many users / programs
  • Data is large and keeps growing
  • Consistency & integrity really matter
  • You need ad-hoc querying and reports
  • Concurrent access is required
  • Security and recovery are critical
📄 A simple file is enough when…
  • Data is tiny and rarely changes
  • Only one program / user touches it
  • It is a one-off or throwaway task
  • No complex relationships exist
  • No concurrent access is needed
  • Speed of setup beats everything else
🛠️
Engineer's Judgment

"Use a database" is not always right. A config file or CSV is perfectly respectable for small, private, simple data. Reach for a DBMS the moment sharing, scale, or safety enters the picture.

Section 10 · Hands-On

The Database Approach in Python (sqlite3)

One source of truth: Riya is stored once; marks reference her id, not her name.

import sqlite3
conn = sqlite3.connect('college.db')

# Structure defined once — the DBMS stores it in its catalog
conn.execute("CREATE TABLE students(id INTEGER PRIMARY KEY, name TEXT, dept TEXT)")
conn.execute("""CREATE TABLE marks(
      sid INTEGER, subject TEXT, score INTEGER,
      FOREIGN KEY(sid) REFERENCES students(id))""")   # referential integrity

# Ask a brand-new question with SQL — no new program needed
rows = conn.execute("""SELECT s.name, s.dept, m.score FROM marks m
      JOIN students s ON s.id = m.sid
      WHERE m.subject = 'DBMS' ORDER BY m.score DESC""")
for name, dept, score in rows:
    print(f" {name} ({dept}) -> {score}")
Output
Top DBMS scorers: Neha (CSE) -> 91 Riya (CSE) -> 88
🧪
Atomicity — All-or-Nothing

Wrap writes in a transaction (with conn:). If a bad row fails mid-way, the whole block rolls back as if it never happened — protection a loose file can never give.

Section 11 · Part 1

Key Takeaways — Rules 1 to 4

🏆 THE GOLDEN RULES · 1–4
1
Get the vocabulary right. Data is raw facts, a database is organized related data, a DBMS is the software that manages it. Database + DBMS = a database system.
2
File systems' fatal flaw: data and programs are glued together. Every disadvantage — redundancy, inconsistency, poor sharing, hard maintenance — flows from this one weakness.
3
Four defining characteristics. Self-describing nature (data + metadata), program–data independence, multiple views, and controlled sharing with transactions.
4
A DBMS beats files by turning redundancy into controlled redundancy, enforcing integrity centrally, supporting SQL, and adding concurrency, security and recovery.
Section 11 · Part 2

Key Takeaways — Rules 5 to 7

🏆 THE GOLDEN RULES · 5–7
5
Real costs matter. A DBMS brings money, complexity, a DBA and a single point of failure. Power is never free — respect the trade-off.
6
Choose the tool for the job. Reach for a DBMS when data is shared, large or critical; a plain file is fine for tiny, single-user, throwaway data.
7
The chokepoint principle. Every read and write passes through the DBMS — that single chokepoint is what makes independence, integrity, security and concurrency enforceable.
Remember

The fatal flaw of files is coupling; the gift of a DBMS is the chokepoint. Everything else in databases builds on these two ideas.

FINAL

Bringing It Together — One Source of Truth

🗄️ Shared Student Record 🏠 Hostel 📚 Library 📝 Exams
1Shared source of truth
9File-system problems solved
4Core characteristics
SQLOne language, any question
🎓
The Foundation Is Set

Hostel, Library and Exams are just views over one shared record. This single architectural choice — a database system instead of files — is why the whole field exists. Everything next (data models, the relational model, SQL, normalization, transactions) builds on it.

🗄️ End of tutorial · Press to review, or click Restart