Third Normal Form   «Prev  Next»

Lesson 8 Boyce-Codd Normal Form (BCNF)
Objective Understand and apply Boyce-Codd Normal Form to eliminate anomalies caused by non-superkey determinants in functional dependencies.

Boyce-Codd Normal Form (BCNF)

Boyce-Codd Normal Form (BCNF), sometimes informally called “3.5NF,” is a stricter version of Third Normal Form (3NF). While 3NF removes most redundancy by eliminating partial and transitive dependencies, BCNF goes one step further: it requires that every determinant in a functional dependency be a superkey. This prevents certain subtle anomalies that can still occur in 3NF schemas.

Formal Definition of BCNF

Let a relation R have a set of functional dependencies (FDs). R is in Boyce-Codd Normal Form if, for every non-trivial functional dependency X → Y that holds in R:

  • X is a superkey of R.

A dependency X → Y is non-trivial if Y is not a subset of X. In other words, in BCNF you are not allowed to have an attribute (or set of attributes) determining something else unless that determinant uniquely identifies each row in the table.

BCNF vs. Third Normal Form (3NF)

A relation in BCNF is always in 3NF, but the reverse is not guaranteed. The key difference lies in how they treat functional dependencies whose left-hand side is not a superkey:

  • 3NF condition (informal): For every FD X → A, either
    • X is a superkey, or
    • A is a prime attribute (part of some candidate key).
  • BCNF condition: For every FD X → Y, X must be a superkey—no exceptions.

As a result, some relations can satisfy 3NF while still violating BCNF. These cases usually appear when a non-superkey attribute determines another attribute, even if that dependent attribute participates in a candidate key.

Example of a BCNF Violation

Consider a relation that records which instructor teaches which student a given subject:

Student Instructor Subject
Alice Dr. Smith Math
Bob Dr. Smith Math
Alice Dr. Jones Physics

Assume the following:

  • Candidate key: {Student, Subject} uniquely identifies each row.
  • Functional dependency: Instructor → Subject (each instructor teaches exactly one subject).

Under these assumptions, the relation is in 3NF:

  • The dependency {Student, Subject} → Instructor has a superkey on the left-hand side.
  • For the dependency Instructor → Subject, the right-hand side (Subject) is a prime attribute because it is part of a candidate key.

However, the relation is not in BCNF, because:

  • Instructor is not a superkey, yet it determines Subject.

This leads to anomalies:

  • Update anomaly: If Dr. Smith switches from teaching Math to Calculus, you must update multiple rows consistently.
  • Insert anomaly: You cannot record that Dr. Lee teaches Chemistry until at least one student is assigned.
  • Delete anomaly: If you delete the last student assigned to Dr. Jones, you lose the fact that Dr. Jones teaches Physics.

Decomposing the Relation into BCNF

To bring the design into BCNF, decompose the original relation based on the non-superkey dependency Instructor → Subject:

1. InstructorSubject – captures which subject each instructor teaches:

Instructor Subject
Dr. Smith Math
Dr. Jones Physics
  • Primary key: Instructor

2. StudentInstructor – associates students with instructors:

Student Instructor
Alice Dr. Smith
Bob Dr. Smith
Alice Dr. Jones
  • Primary key: {Student, Instructor}
  • Foreign key: Instructor references InstructorSubject(Instructor).

After decomposition:

  • All functional dependencies have superkeys on their left-hand side.
  • The design is in BCNF.
  • Update, insert, and delete anomalies are removed: changing an instructor’s subject now requires updating only one row in InstructorSubject.

3NF and BCNF Compared

Property Third Normal Form (3NF) Boyce-Codd Normal Form (BCNF)
Definition For every FD X → A, either X is a superkey, or A is a prime attribute. For every non-trivial FD X → Y, X must be a superkey.
Redundancy May leave some redundancy when non-superkey determinants determine prime attributes. Eliminates redundancy caused by all non-superkey determinants.
Decomposition Always has a lossless, dependency-preserving decomposition. Always has a lossless decomposition, but may require sacrificing dependency preservation.
Strength Weaker condition; every BCNF schema is in 3NF. Stronger condition; some 3NF schemas are not in BCNF.
Proposed by Edgar F. Codd. Raymond F. Boyce and Edgar F. Codd.

Why BCNF Matters in Practice

BCNF is particularly useful when you discover that certain attributes (such as instructor, department, or room) determine other attributes but are not themselves keys. If you leave these dependencies in place, you risk subtle anomalies and duplicated facts spread across multiple rows. Decomposing into BCNF:

  • Improves data integrity by centralizing each fact in exactly one place.
  • Reduces the risk of inconsistent updates to critical business rules.
  • Provides a cleaner, more predictable schema for application developers and query writers.

BCNF and Higher Normal Forms

BCNF focuses on functional dependencies. Beyond BCNF, Fourth Normal Form (4NF) tackles multi-valued dependencies, and Fifth Normal Form (5NF) addresses join dependencies. In most operational systems, designing to 3NF or BCNF is sufficient. Higher normal forms are typically reserved for specialized designs or advanced academic treatment.

As a design guideline: aim for at least 3NF, consider BCNF when you detect non-superkey determinants, and then selectively denormalize later if performance tuning requires it.


SEMrush Software 6 SEMrush Banner 6