InterviewHubPRO
Section Overview
Q7

Question 7 of 60

Part 2: Relational Databases (RDBMS / PostgreSQL / MySQL) (6 - 25)

12%
Databases & System Design•Part 2: Relational Databases (RDBMS / PostgreSQL / MySQL) (6 - 25)

Normalization (1NF to BCNF) vs Denormalization:

In Simple Words:

  • Normalization: Eliminates duplicate data and update anomalies by splitting data into related tables (1NF = atomic values, 2NF = full key dependency, 3NF = no transitive dependencies).
  • Denormalization: Intentionally duplicating data (e.g. storing user_name in orders) to avoid expensive SQL JOIN operations on high-throughput read systems.
sql
-- Normalized: Requires JOIN between orders and users:
SELECT o.id, u.name, o.total FROM orders o JOIN users u ON o.user_id = u.id;

-- Denormalized: Order table already stores user_name for instant O(1) row read:
SELECT id, user_name, total FROM orders WHERE id = 101;