DBMS
DBMS Part-1
- DBMS Introduction
- DBMS Architecture
- Database Approach vs Traditional File System
- Advantages of DBMS
- Data Models in DBMS
- Schemas in DBMS
- Instances in DBMS
- Data Independence in DBMS
- Database Languages in DBMS
- Interfaces in DBMS
- Structure of DBMS
- Functions of DBA and Designer
- Entities and Attributes in DBMS
- ER Diagram in DBMS
- Generalization, Specialization and Aggregation in DBMS
- Converting ER Diagram to Tables in DBMS
- Difference between Object Oriented, Network and Relational Data Models
DBMS Part-2
- Relational Data Model in DBMS
- Keys in DBMS
- SQL Introduction
- DDL(Data Definition Language)
- DML(Data Manipulation Language)
- Integrity Constraints in DBMS
- Complex SQL Queries
- Joins in DBMS
- Indexing in DBMS
- Triggers in DBMS
- Assertions in DBMS
- Relational Algebra in DBMS
- Tuple Relational Calculus in DBMS
- Domain Relational Calculus in DBMS
DBMS Part-3
- Introduction to Normalization in DBMS
- Normal Forms in DBMS
- Functional Dependency in DBMS
- Decomposition in DBMS
- Dependency Preserving Decomposition in DBMS
- Lossless Join Decomposition in DBMS
- Problems with Null Values and Dangling Tuples
- Multivalued Dependency in DBMS
- Query Optimization in DBMS
- Algorithms for Select, Project and Join Operations in DBMS
- Query Optimization Methods in DBMS
DBMS Part-4
- Transactions in DBMS
- Serializability in DBMS
- Recoverability in DBMS
- Recovery Techniques in DBMS
- Log Based Recovery in DBMS
- Checkpoint in DBMS
- Deadlock in DBMS
- Concurrency Control in DBMS
- Lock Based Protocol in DBMS
- Timestamp Based Protocol in DBMS
- Validation Based Protocol in DBMS
- Multiple Granularity in DBMS
- Multi-Version Concurrency Control(MVCC) in DBMS
- Recovery with Concurrent Transactions in DBMS
DBMS Part-5
Transactions in DBMS
Transaction kya hota hai?
Transaction ka matlab hai ek group of operations (jaise read, write, update, delete) jo database par ek saath perform ki jaati hain. Ye operations ek single unit ki tarah treat kiye jaate hain.
Example: ₹1000 ko Account A se Account B me transfer karna
Isme ye steps honge:
Account A ka balance read karo
₹1000 minus karo
New balance write karo
Account B ka balance read karo
₹1000 add karo
New balance write karo
Yeh poora process ek hi transaction kehlaata hai. Agar beech mein koi step fail ho gaya, toh poora ka poora transaction cancel ho jaata hai — yeh rollback kehlata hai.
ACID Properties – Transaction ke rules
Transaction ko reliable banane ke liye, 4 important properties hoti hain – ACID:
Property | Meaning in Hinglish |
---|---|
A – Atomicity | Ya toh sab kuch hoga ya kuch bhi nahi hoga. |
C – Consistency | Database hamesha valid state mein rehna chahiye. |
I – Isolation | Ek transaction doosre se alag hona chahiye. |
D – Durability | Transaction complete hone ke baad data permanent save ho jaata hai. Crash ke baad bhi change rehta hai. |
Transaction ke States (Stages)
Transaction kuch stages se guzarta hai:
Start
↓
[Active]
↓
[Partially Committed]
↓ ↓
[Committed] [Failed]
↓ ↓
End [Rollback]
↓
End
Active: Transaction execute horha hai.
Partially Committed: Saare operations ho chuke hai, save hone ke liye ready hai.
Committed: Changes Database me permanently save ho chuke hai.
Failed: Something went wrong.
Aborted: Saare changes ko roll back kiya gaya.
Commit aur Rollback kya hota hai?
Command | Kya karta hai? |
---|---|
COMMIT | Changes ko permanently database mein save karta hai. |
ROLLBACK | Changes ko undo karta hai, yaani pehle wali state mein le jaata hai. |
Example:
BEGIN;
UPDATE account SET balance = balance - 1000 WHERE acc_id = 'A';
UPDATE account SET balance = balance + 1000 WHERE acc_id = 'B';
COMMIT;
Agar beech mein error aa gaya:
ROLLBACK;
Diagram se samjho
Successful Transaction Flow
[Start Transaction]
↓
[Read A] → [Update A] → [Write A]
↓
[Read B] → [Update B] → [Write B]
↓
[Commit]
Error ke saath Transaction
[Start Transaction]
↓
[Read A] → [Update A] → [Write A]
↓
[Read B]
↓
[Error!]
↓
[Rollback all changes]
Transactions important kyun hote hain?
Data sahi rehta hai (Accuracy)
Banking system mein agar ₹1000 cut ho gaya lekin doosre account mein add nahi hua, toh dikkat ho sakti hai.System crash hone par bhi safe
Rollback se hum data loss se bach sakte hain.Multiple users ka safe access
Isolation ke through users apna kaam safe kar sakte hain bina clash ke.
Summary
Transaction ek group of steps hota hai jo database pe ek saath perform hote hain.
ACID properties se transaction reliable banta hai.
Commit = Save
Rollback = Undo
Real-life examples: Banking, shopping, ticket booking, etc.