← Back to Databases

Normalization

DatabasesMiddborm

The Question

What is database normalization and what are the normal forms?

What a Strong Answer Covers

  • Partial dependency (2NF) and transitive dependency (3NF) terms.

Senior-Level Answer

Database normalization is the process of structuring a relational schema to reduce data redundancy and eliminate update anomalies. The motivation: storing the same fact in multiple places means updates must happen in multiple places -- miss one, and the database becomes inconsistent. Normalization progressively decomposes tables based on functional dependencies.

First Normal Form (1NF) requires that each column contain only atomic (indivisible) values and that each row be uniquely identifiable. A column storing comma-separated tags or a repeating group of columns (phone1, phone2, phone3) violates 1NF. Fix: extract multi-valued attributes into a separate table with a foreign key.

Second Normal Form (2NF) requires 1NF plus that every non-key column is fully functionally dependent on the entire primary key -- no partial dependencies. This applies only to tables with composite primary keys. If a table (OrderID, ProductID, ProductName) has ProductName depending on ProductID alone (not the full composite key), ProductName is a partial dependency. Fix: move ProductName to a Products table keyed by ProductID.

Third Normal Form (3NF) requires 2NF plus no transitive dependencies -- no non-key column should depend on another non-key column. If a table has (EmployeeID, DepartmentID, DepartmentName) and DepartmentName depends on DepartmentID (not EmployeeID directly), that is a transitive dependency. Fix: move DepartmentName to a Departments table. 3NF is the practical target for most OLTP schemas.

Boyce-Codd Normal Form (BCNF) strengthens 3NF by requiring that every determinant is a candidate key. Some 3NF tables with overlapping candidate keys still have anomalies; BCNF eliminates them.

Normalization improves write integrity and reduces storage but can hurt read performance by requiring joins. OLAP systems often deliberately denormalize (star/snowflake schemas) to reduce join complexity for analytical queries.

What Separates a 2/3 from a 3/3

2/3 — Passing but Incomplete

Candidate can define 1NF, 2NF, and 3NF with reasonable accuracy and understands that normalization removes redundancy, but cannot give concrete examples of partial vs transitive dependencies or discuss denormalization trade-offs.

3/3 — Strong Answer

Candidate defines 1NF through 3NF precisely with concrete examples of each violation and fix, explains functional dependencies clearly, mentions BCNF, discusses read-performance trade-offs, and knows when to denormalize for OLAP workloads.

Common Mistakes

  • Defining 2NF without noting it only applies to composite primary key tables -- single-column PKs are automatically in 2NF
  • Confusing partial dependencies (2NF) with transitive dependencies (3NF)
  • Treating normalization as always correct -- OLAP schemas deliberately violate 3NF for query performance
  • Stopping at 3NF without knowing BCNF exists or what motivates it

Follow-Up Questions

  • What is a functional dependency? — Column A functionally determines column B if every row with the same A value has the same B value -- written A determines B.
  • When would you deliberately denormalize a schema? — For read-heavy analytical queries where join cost is prohibitive -- data warehouses use star/snowflake schemas with intentional redundancy for query speed.
  • What is the difference between 3NF and BCNF? — In 3NF, non-prime attributes must not transitively depend on any key. BCNF is stricter: every determinant must be a superkey -- it catches anomalies 3NF misses with overlapping candidate keys.

Related Questions

  • ACID
  • Indexes
  • Clustered vs Non-clustered
  • Isolation Levels
  • PostgreSQL Internals — MVCC, WAL, VACUUM

Can You Explain This Cold?

Reading the answer is step one. Explaining it unprompted — under interview pressure — is what actually matters. Get AI-graded feedback on your answer with follow-up probes on your weak points.

Get Graded — Free Assessment
GrindQuestionsAITechnical interview assessment
TermsPrivacyAbout