File System vs DBMS
What is a File System?
Examples of File System usage:
- School keeps student list in one Excel file, fee records in another, and library records in a third — all separate.
- Office stores employee data in Word documents and salary in a calculator file.
- No automatic connection between files — manual work required to combine them.
What is DBMS?
Examples: MySQL, Oracle, MS SQL Server, PostgreSQL, MS Access.
- All school data in one database — students, fees, library, attendance all linked.
- Any authorized user can query data instantly with SQL.
- Multiple users access simultaneously without data conflict.
File System vs DBMS – Full Comparison
| Feature | File System | DBMS |
|---|---|---|
| Data Storage | Separate, unconnected files | Centralized, structured database |
| Data Redundancy | High — same data in many files | Low — data stored once, linked by keys |
| Data Inconsistency | High — updating one file doesn't update others | Low — one update reflects everywhere |
| Data Sharing | Difficult — files must be manually shared | Easy — multiple users query same database |
| Data Security | No user-level access control | Role-based permissions (admin, teacher, student) |
| Data Integrity | No automatic constraints | PRIMARY KEY, NOT NULL, CHECK, FOREIGN KEY |
| Concurrent Access | Two users editing same file = data loss | Transactions + locking prevent conflicts |
| Backup & Recovery | Manual copy of files — error-prone | mysqldump, automated backup tools |
| Query/Search | Manual searching through file contents | SQL SELECT — instant search with conditions |
| Crash Recovery | Data lost if system crashes during write | Transaction rollback saves data on crash |
| Scalability | Very poor — slow as files grow | Good — indexes and optimization handle large data |
| Cost | Low initial setup | Higher setup but lower long-term cost |
Problems of File System (Detailed)
1. Data Redundancy: Student name stored in fee file, result file and library file separately. If name has a typo, it must be corrected in all 3 files manually.
2. Data Inconsistency: Student address updated in fee register but forgotten in library card → two different addresses for same student → which is correct?
3. Data Isolation: Fee file in Excel, library in Word, attendance in paper register → impossible to combine and analyze together.
4. No Concurrent Access: Two clerks open the same Excel fee file → one overwrites the other's changes → data loss.
5. Security Issues: Any teacher with computer access can open fee records, modify salary data, or delete important files accidentally.
6. No Integrity Rules: A student's marks can be entered as "abc" or -50 — file system doesn't prevent it.
7. Difficult Querying: To find "students from Khurja who paid fee and have overdue library books" — manually search 3 files and cross-reference → hours of work vs. 1 SQL JOIN query in DBMS.
SQL Demo – DBMS Solves File System Problems
-- In DBMS: One database, all data connected
CREATE DATABASE school_db;
USE school_db;
CREATE TABLE students (
roll_no INT PRIMARY KEY, -- integrity: no duplicate students
name VARCHAR(80) NOT NULL, -- integrity: name cannot be blank
city VARCHAR(50)
);
CREATE TABLE fee_records (
fee_id INT PRIMARY KEY AUTO_INCREMENT,
roll_no INT NOT NULL,
amount DECIMAL(10,2),
paid_date DATE,
FOREIGN KEY (roll_no) REFERENCES students(roll_no) -- no orphan records
);
CREATE TABLE library (
lib_id INT PRIMARY KEY AUTO_INCREMENT,
roll_no INT,
book_name VARCHAR(100),
return_date DATE,
FOREIGN KEY (roll_no) REFERENCES students(roll_no)
);
INSERT INTO students VALUES (1,'Aarav Sharma','Khurja'),(2,'Priya Verma','Aligarh');
INSERT INTO fee_records (roll_no,amount,paid_date) VALUES (1,5000,'2025-04-10'),(2,5000,'2025-04-15');
INSERT INTO library (roll_no,book_name,return_date) VALUES (1,'Physics NCERT','2025-05-01');
-- Complex query that would take hours in file system — seconds in DBMS
SELECT s.name, s.city, f.amount AS fee_paid, l.book_name AS book_borrowed
FROM students s
JOIN fee_records f ON s.roll_no = f.roll_no
LEFT JOIN library l ON s.roll_no = l.roll_no
WHERE s.city = 'Khurja';
+--------------+--------+----------+-----------------+
| name | city | fee_paid | book_borrowed |
+--------------+--------+----------+-----------------+
| Aarav Sharma | Khurja | 5000.00 | Physics NCERT |
+--------------+--------+----------+-----------------+
File system: search 3 files manually. DBMS: one SQL query, instant result.
Common Mistakes
- Thinking file system is always worse: For very small, simple, one-user data — files can work. DBMS overhead isn't always needed.
- Not using foreign keys in DBMS: Without foreign keys, DBMS behaves like a file system — no referential integrity.
- Confusing DBMS with Database: Database is the data; DBMS is the software that manages it (MySQL is DBMS, school_db is Database).
- Not setting user privileges: Installing MySQL and giving everyone root access defeats the security advantage of DBMS.
Practice Tasks
- Draw a diagram showing how a school stores data in File System vs DBMS — show connections between fee, library and student data.
- List 5 specific problems a school would face if it used only Excel files for student data. For each problem, write how DBMS solves it.
- Create the
school_dbfrom the SQL demo above. Write a query to find all students who have a library book pending return. - Viva: "What is data redundancy? Give an example from a file system." — Write a 3-line answer.
Summary
- File System = Separate files, no control, high redundancy, poor security.
- DBMS = Centralized, structured, secure, concurrent, with SQL querying.
- DBMS solves: Redundancy, Inconsistency, Isolation, Security, Integrity, Concurrency issues.
- Key DBMS examples: MySQL, Oracle, MS SQL Server, PostgreSQL.
- In real projects: Always use DBMS for multi-user, multi-table, scalable applications.