❌ Unnormalized Table (Full of Problems!)
| OrderID |
CustomerName |
CustomerAddress |
Products |
ProductPrices |
CustomerCity |
CustomerPincode |
| 1 |
Alice |
123 Main St |
Soap, Shampoo |
50, 120 |
New York |
10001 |
| 2 |
Alice |
123 Main St |
Toothpaste |
80 |
New York |
10001 |
| 3 |
Bob |
456 Oak Ave |
Bread, Butter |
30, 25 |
New York |
10001 |
Problems:
• Multiple values in one cell (Products, Prices)
• Repeated customer data (Data Redundancy)
• Changing Alice’s address requires multiple updates
• Wastes storage space
1️⃣ First Normal Form (1NF) - Atomic Values
| OrderID |
CustomerName |
CustomerAddress |
Product |
ProductPrice |
CustomerCity |
CustomerPincode |
| 1 |
Alice |
123 Main St |
Soap |
50 |
New York |
10001 |
| 1 |
Alice |
123 Main St |
Shampoo |
120 |
New York |
10001 |
| 2 |
Alice |
123 Main St |
Toothpaste |
80 |
New York |
10001 |
| 3 |
Bob |
456 Oak Ave |
Bread |
30 |
New York |
10001 |
| 3 |
Bob |
456 Oak Ave |
Butter |
25 |
New York |
10001 |
✅ 1NF Done: Each cell contains only one value!
Pro Tip: "One value per cell—no mixing things up!"
2️⃣ Second Normal Form (2NF) - Remove Partial Dependencies
📋 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 | Alice | 123 Main St | New York | 10001 |
| 102 | Bob | 456 Oak Ave | New York | 10001 |
🛍️ Products Table
| ProductID |
ProductName |
Price |
| 201 | Soap | 50 |
| 202 | Shampoo | 120 |
| 203 | Toothpaste | 80 |
| 204 | Bread | 30 |
| 205 | Butter | 25 |
✅ 2NF Done: Removed partial dependencies!
Pro Tip: "Customer info depends only on CustomerID, product info on ProductID!"
3️⃣ Third Normal Form (3NF) - Remove Transitive Dependencies
👥 Customers Table (Updated)
| CustomerID |
CustomerName |
CustomerAddress |
LocationID |
| 101 | Alice | 123 Main St | 1 |
| 102 | Bob | 456 Oak Ave | 1 |
📍 Locations Table (New)
| LocationID |
City |
Pincode |
| 1 | New York | 10001 |
✅ 3NF Done: Removed transitive dependencies!
Pro Tip: "City and Pincode depend on LocationID, so we created a separate Locations table!"