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
Normalization in DBMS
Normalization ek process hai jisme hum database ko design karte waqt usme se redundancy (data ka repetition) aur inconsistency (confusing ya galat data) hataate hain.
Normalization step-by-step hota hai using Normal Forms – jaise 1NF, 2NF, 3NF, BCNF, 4NF, and 5NF.
1NF (First Normal Form)
Condition: Table ka har column atomic hona chahiye.
Matlab, har cell mein sirf ek value ho – na ki list ya group.
Example:
StudentID | Name | Courses |
---|---|---|
101 | Rahul | Math, Science |
102 | Priya | English |
Yeh table 1NF nahi hai kyunki “Courses” column mein multiple values hain.
1NF version:
StudentID | Name | Course |
---|---|---|
101 | Rahul | Math |
101 | Rahul | Science |
102 | Priya | English |
2NF (Second Normal Form)
Condition:
-
Table 1NF mein hona chahiye
-
Har non-key column fully dependent hona chahiye entire primary key par, na ki uske part par.
Example (1NF but not 2NF):
StudentID | Course | StudentName |
---|---|---|
101 | Math | Rahul |
101 | Science | Rahul |
Yahan StudentName sirf StudentID pe depend hai, na ki (StudentID + Course) ke combination par. Isiliye 2NF nahi hai.
2NF version:
Student Table:
StudentID | StudentName |
---|---|
101 | Rahul |
Course Table:
StudentID | Course |
---|---|
101 | Math |
101 | Science |
3NF (Third Normal Form)
Condition:
-
Table 2NF mein hona chahiye
-
Non-key columns sirf primary key pe dependent hone chahiye, doosre non-key column pe nahi.
Example (2NF but not 3NF):
StudentID | StudentName | Department | HOD |
---|---|---|---|
101 | Rahul | CS | Dr. Meena |
Yahan HOD dependent hai Department pe, not directly on StudentID → violation of 3NF.
3NF version:
Student Table:
StudentID | StudentName | Department |
---|---|---|
101 | Rahul | CS |
Department Table:
Department | HOD |
---|---|
CS | Dr. Meena |
BCNF (Boyce-Codd Normal Form)
Condition:
Table 3NF mein ho + har determinant super key hona chahiye.
Determinant: Jo kisi column ki value decide karta hai.
Example:
Course | Teacher | Room |
---|---|---|
Math | Mr. A | 101 |
Science | Mr. B | 102 |
Assume ek teacher ek hi course padhata hai, lekin teacher bhi room decide karta hai.
Yahan Teacher → Course and Teacher → Room, but Teacher primary key nahi hai. Isiliye BCNF violated.
Split into BCNF:
Teacher_Course Table:
Teacher | Course |
---|---|
Mr. A | Math |
Teacher_Room Table:
Teacher | Room |
---|---|
Mr. A | 101 |
4NF (Fourth Normal Form)
Condition:
No multi-valued dependency if table already in BCNF.
Multi-valued Dependency Example:
Student | Course | Hobby |
---|---|---|
Rahul | Math | Cricket |
Rahul | Science | Cricket |
Rahul | Math | Singing |
Yahan Rahul ke paas do courses aur do hobbies hain → toh combinations ban rahe hain unnecessarily.
4NF version:
Student_Course Table:
Student | Course |
---|---|
Rahul | Math |
Rahul | Science |
Student_Hobby Table:
Student | Hobby |
---|---|
Rahul | Cricket |
Rahul | Singing |
5NF (Fifth Normal Form)
Condition:
4NF me hona chahiye
Table should be broken down to remove join dependencies. 5NF mainly tab use hoti hai jab data redundant ho due to complex joins.
Example:
Suppose ek product multiple vendors se aa raha hai and multiple customers ko jaa raha hai. To avoid unnecessary combinations, hum 5NF apply karte hain.
Summary Table:
Normal Form | Kya Remove Karta Hai |
---|---|
1NF | Repeating groups/multi-values |
2NF | Partial dependency |
3NF | Transitive dependency |
BCNF | Non-super key determinants |
4NF | Multi-valued dependency |
5NF | Join dependency |