File System vs DBMS
File System क्या है?
- School में student list एक Excel में, fee दूसरी में, library तीसरी में — सब अलग।
- Files के बीच कोई automatic connection नहीं — manually combine करना पड़ता है।
DBMS क्या है?
Examples: MySQL, Oracle, MS SQL Server, PostgreSQL, MS Access.
File System vs DBMS – पूरा अंतर
| Feature | File System | DBMS |
|---|---|---|
| Data Storage | Separate, unconnected files | Centralized, structured database |
| Data Redundancy | High — same data कई files में | Low — data एक बार, keys से linked |
| Data Inconsistency | High — एक file update, दूसरी नहीं | Low — एक update सब जगह |
| Data Sharing | मुश्किल — manually share करना पड़े | आसान — multiple users एक database |
| Data Security | No access control | Role-based permissions |
| Data Integrity | कोई constraints नहीं | PRIMARY KEY, NOT NULL, CHECK |
| Concurrent Access | Two users = data loss | Transactions + locking |
| Backup & Recovery | Manual file copy | mysqldump, automated backup |
| Search/Query | Manual searching | SQL SELECT — instant |
| Crash Recovery | Data loss on crash | Transaction rollback |
File System की समस्याएं (Detail में)
1. Data Redundancy: Student का नाम fee file, result file और library file — तीनों में अलग-अलग। एक जगह typo हो तो तीनों में manually fix करो।
2. Data Inconsistency: Address fee register में update हुआ, library card में नहीं → एक ही student के दो अलग addresses → कौन सा सही?
3. Data Isolation: Fee Excel में, library Word में, attendance paper पर → combine करके analyze करना impossible।
4. No Concurrent Access: दो clerk एक Excel file खोलें → एक दूसरे का data overwrite करे → data loss।
5. Security Issues: Computer access वाला कोई भी teacher fee records खोल सकता है, salary modify कर सकता है।
6. No Integrity: Marks field में "abc" या -50 enter हो सकता है — कोई रोकने वाला नहीं।
7. Difficult Query: "Khurja के students जिन्होंने fee दी और library book भी है" — 3 files manually search करो। DBMS में: 1 SQL JOIN query = seconds में result।
SQL Demo
CREATE DATABASE school_db;
USE school_db;
CREATE TABLE students (
roll_no INT PRIMARY KEY,
name VARCHAR(80) NOT NULL,
city VARCHAR(50)
);
CREATE TABLE fee_records (
fee_id INT PRIMARY KEY AUTO_INCREMENT,
roll_no INT NOT NULL,
amount DECIMAL(10,2),
FOREIGN KEY (roll_no) REFERENCES students(roll_no)
);
-- तीनों "files" (tables) को एक SQL query से combine करें
SELECT s.name, s.city, f.amount AS fee_paid
FROM students s
JOIN fee_records f ON s.roll_no = f.roll_no
WHERE s.city = 'Khurja';
DBMS में: एक SQL query — seconds में result।
Common Mistakes
- File system हमेशा बुरा नहीं: बहुत छोटे, single-user data के लिए files काम कर सकती हैं।
- Foreign keys न use करना: Foreign keys के बिना DBMS भी file system जैसा behave करता है।
- DBMS और Database confuse करना: MySQL = DBMS (software); school_db = Database (data)।
- सबको root access देना: यह DBMS के security advantage को खत्म करता है।
Practice Tasks
- School में File System vs DBMS का diagram बनाएं — fee, library और student data के connections दिखाएं।
- 5 problems लिखें जो school को Excel files use करने से होंगी। हर problem का DBMS solution लिखें।
- SQL demo से school_db बनाएं। Query लिखें: सभी students जिनकी library book return नहीं हुई।
- Viva: "Data redundancy क्या है? File system में example दें।" — 3 lines में answer।
Summary
- File System = Separate files, no control, high redundancy, poor security।
- DBMS = Centralized, structured, secure, concurrent, SQL querying।
- DBMS solve करता है: Redundancy, Inconsistency, Isolation, Security, Integrity, Concurrency।
- Real projects में: हमेशा DBMS use करें — multi-user, scalable applications के लिए।