❌ Unnormalized Table (Problems ka Mela!)
OrderID |
CustomerName |
CustomerAddress |
Products |
ProductPrices |
CustomerCity |
CustomerPincode |
1 |
Babita |
Gokuldham Society |
Soap, Shampoo |
50, 120 |
Mumbai |
400001 |
2 |
Babita |
Gokuldham Society |
Toothpaste |
80 |
Mumbai |
400001 |
3 |
Jethalal |
Gokuldham Society |
Fafda, Dhokla |
30, 25 |
Mumbai |
400001 |
Problems:
• Ek cell mein multiple values (Products, Prices)
• Customer data repeat ho raha hai (Data Redundancy)
• Babita ka address change ho toh dikkat
• Storage ka wastage
1️⃣ First Normal Form (1NF) - Atomic Values
OrderID |
CustomerName |
CustomerAddress |
Product |
ProductPrice |
CustomerCity |
CustomerPincode |
1 |
Babita |
Gokuldham Society |
Soap |
50 |
Mumbai |
400001 |
1 |
Babita |
Gokuldham Society |
Shampoo |
120 |
Mumbai |
400001 |
2 |
Babita |
Gokuldham Society |
Toothpaste |
80 |
Mumbai |
400001 |
3 |
Jethalal |
Gokuldham Society |
Fafda |
30 |
Mumbai |
400001 |
3 |
Jethalal |
Gokuldham Society |
Dhokla |
25 |
Mumbai |
400001 |
✅ 1NF Done: Har cell mein sirf ek value!
Jethalal: "Ek cell mein ek hi cheez - comma wala mix-up nahi!"
2️⃣ Second Normal Form (2NF) - Partial Dependencies Hatao
📋 Orders Table
OrderID |
CustomerID |
ProductID |
1 | 101 | 201 |
1 | 101 | 202 |
2 | 101 | 203 |
3 | 102 | 204 |
3 | 102 | 205 |
👥 Customers Table
CustomerID |
CustomerName |
CustomerAddress |
City |
Pincode |
101 | Babita | Gokuldham Society | Mumbai | 400001 |
102 | Jethalal | Gokuldham Society | Mumbai | 400001 |
🛍️ Products Table
ProductID |
ProductName |
Price |
201 | Soap | 50 |
202 | Shampoo | 120 |
203 | Toothpaste | 80 |
204 | Fafda | 30 |
205 | Dhokla | 25 |
✅ 2NF Done: Partial dependencies hata di!
Jethalal: "Customer info bas CustomerID pe depend kare, Product info bas ProductID pe!"
3️⃣ Third Normal Form (3NF) - Transitive Dependencies Hatao
👥 Customers Table (Updated)
CustomerID |
CustomerName |
CustomerAddress |
LocationID |
101 | Babita | Gokuldham Society | 1 |
102 | Jethalal | Gokuldham Society | 1 |
📍 Locations Table (New)
LocationID |
City |
Pincode |
1 | Mumbai | 400001 |
✅ 3NF Done: Transitive dependencies hata di!
Jethalal: "City aur Pincode pe depend karta hai, toh Locations table alag banaya!"