Database Normalization Interactive Demo

Master Database Normalization with Fullstackgada’s Fun Approach!

🔄 Data Redundancy Problem

The Challenge: Storing the same customer data multiple times causes update issues!
Click the buttons above to see the difference between redundant and normalized data!

📊 Normal Forms Explorer

Pro Tip: Learn how normal forms clean up data step-by-step!

🏠 Shopping Example

🤔
Select a Normal Form to see the explanation!

🎭 Step-by-Step Normalization Process

❌ 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
1101201
1101202
2101203
3102204
3102205
👥 Customers Table
CustomerID CustomerName CustomerAddress City Pincode
101Alice123 Main StNew York10001
102Bob456 Oak AveNew York10001
🛍️ Products Table
ProductID ProductName Price
201Soap50
202Shampoo120
203Toothpaste80
204Bread30
205Butter25
✅ 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
101Alice123 Main St1
102Bob456 Oak Ave1
📍 Locations Table (New)
LocationID City Pincode
1New York10001
✅ 3NF Done: Removed transitive dependencies!
Pro Tip: "City and Pincode depend on LocationID, so we created a separate Locations table!"

⚖️ Normalization vs Denormalization

Aspect ✅ Normalization ⚡ Denormalization
Data Redundancy Minimal duplication Intentional duplication for speed
Storage Space Less storage needed More storage required
Query Performance Requires JOINs (slower reads) Direct access (faster reads)
Data Consistency High consistency Risk of inconsistency
Updates Update in one place (easier) Update multiple places (harder)
Best For OLTP systems, frequent updates OLAP systems, reporting, read-heavy
Pro Tip: Normalization is like organizing your closet for efficiency, but denormalization is like keeping duplicates for quick access when reporting!