Skip to main content
← All posts

Part 4: Database Normalization: From 1NF to BCNF and De-normalization Rules

Md. Harun-Or-RoshidNov 5, 20264 min readArticle
Part 4: Database Normalization: From 1NF to BCNF and De-normalization Rules

Module Overview

Database normalization is the formal mathematical technique used to evaluate and refine relational schemas to minimize data redundancy and eliminate destructive update anomalies. In this fourth installment, we explore the theory of Functional Dependencies (FDs), Armstrong's Axioms, attribute closures, and the progressive stages of normalization from 1NF to Boyce-Codd Normal Form (BCNF). We also examine the mandatory criteria for lossless-join decomposition and dependency preservation, alongside pragmatic engineering rules for intentional denormalization.

1. The Architectural Hazards of Data Redundancy

When a database schema is poorly designed, identical facts are recorded repeatedly. This gives rise to three classic update anomalies:

1. Insertion Anomaly

Inability to insert a record for a department without simultaneously assigning an employee to it, because the primary key contains employee_id which cannot be NULL.

2. Deletion Anomaly

Deleting the final employee working in a department inadvertently purges the department's name, budget, and location from the persistent database entirely.

3. Update Anomaly

Updating a department budget requires modifying thousands of redundant employee records. If any row is missed due to a system crash, conflicting values create permanent inconsistency.

2. Functional Dependencies & Armstrong's Axioms

A Functional Dependency (FD) $X o Y$ between attribute sets $X$ and $Y$ in relation $R$ asserts that whenever two tuples agree on the values of $X$, they must necessarily agree on the values of $Y$:

∀ t1, t2 ∈ R, (t1[X] = t2[X]) ⟹ (t1[Y] = t2[Y])

The complete set of functional dependencies logically implied by a given set $F$ can be derived using Armstrong's Axioms:

1. Reflexivity: If $Y \subseteq X$, then $X o Y$ (trivial dependency).
2. Augmentation: If $X o Y$, then $XZ o YZ$ for any set of attributes $Z$.
3. Transitivity: If $X o Y$ and $Y o Z$, then $X o Z$.

3. Progressive Stages of Normalization

First Normal Form (1NF)

Atomicity of attributes.

A relation is in 1NF if and only if all attribute values are atomic (indivisible scalars) and there are no repeating groups or multivalued arrays stored within a single field.

Violation: Storing a comma-separated list of phone numbers "555-0199, 555-0144" in a single column violates 1NF.

Second Normal Form (2NF)

Elimination of partial key dependencies.

A relation is in 2NF if it is in 1NF and every non-prime attribute (an attribute not part of any candidate key) is fully functionally dependent on the entire primary key, rather than on a proper subset of a composite primary key.

Violation: In schema $(student\_id, course\_id) o grade, course\_name$, the dependency $course\_id o course\_name$ is partial, violating 2NF.

Third Normal Form (3NF)

Elimination of transitive dependencies.

A relation is in 3NF if it is in 2NF and for every non-trivial functional dependency $X o A$, either $X$ is a superkey, or $A$ is a prime attribute (part of some candidate key).

Violation: In $emp\_id o dept\_id$ and $dept\_id o dept\_name$, the non-prime attribute $dept\_name$ is transitively dependent on primary key $emp\_id$.

Boyce-Codd Normal Form (BCNF)

Strict superkey determinant requirement.

A relation is in BCNF if and only if for every non-trivial functional dependency $X o A$, $X$ is strictly a superkey. BCNF eliminates all redundancy arising from functional dependencies, resolving anomalies that can persist in 3NF when relations have multiple overlapping candidate keys.

4. Decomposition Invariants: Lossless-Join & Dependency Preservation

Decomposing a schema $R$ into sub-relations $\{R_1, R_2\}$ must satisfy two fundamental mathematical criteria:

  • Lossless-Join Guarantee: The natural join of the decomposed relations must reproduce the original relation without introducing spurious tuples ($R_1 \Join R_2 = R$). Formally, this holds if and only if $(R_1 \cap R_2) o R_1$ or $(R_1 \cap R_2) o R_2$.
  • Dependency Preservation: All original functional dependencies can be enforced using single-table integrity constraints without requiring costly cross-table joins on write operations. (Note: BCNF decompositions do not always preserve dependencies; 3NF is guaranteed to achieve both lossless joins and dependency preservation).

5. Intentional Denormalization in Modern High-Throughput Architectures

While 3NF/BCNF normalization provides maximum integrity for transactional OLTP writes, high-volume read-heavy applications and Analytical OLAP data warehouses often intentionally denormalize schemas:

  • Eliminating Expensive Multi-Way Joins: Embedding customer names directly onto invoice line-item records avoids five-table joins in microsecond-critical dashboard queries.
  • Pre-aggregated Summary Tables: Maintaining cached counters (e.g., total_upvotes or unread_notifications_count) eliminates expensive COUNT(*) disk scans.
  • Handling Inconsistency: Maintained via database triggers, event-driven message buses (Kafka/RabbitMQ), or eventual consistency synchronization workers.

Next in Curriculum

In Part 5: Advanced SQL: Window Functions, Common Table Expressions & Recursion, we transition from theoretical relational models to practical advanced SQL queries, analytics, and hierarchical data manipulation.

Share:
Share on X
Share on LinkedIn
Share on Facebook
Share on Reddit
Share on WhatsApp
Share on Telegram
Copy link

Related reading

Database Normalization: 1NF to BCNF Rules | Draftsbook · Draftsbook