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 nontrivial 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 nontrivial FD X → A, either
    • X is a superkey, or
    • A is a prime attribute (part of some candidate key).
  • BCNF condition: For every nontrivial 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: A Table in 3NF but Not BCNF

Assume each student has one instructor per course, each instructor teaches exactly one course, and many students can share an instructor. Student, Course, and Instructor are identifiers represented by short labels in this example; production systems should use identifiers appropriate to their business rules.

Teaching before decomposition
StudentCourseInstructor
ADBSmith
BDBSmith
ASQLJones
(Student, Course) → Instructor
Instructor → Course

The candidate keys are (Student, Course) and (Student, Instructor). All three attributes are prime, so the relation satisfies 3NF under these dependencies. However, Instructor is not a superkey: Smith occurs in two rows. The dependency Instructor → Course therefore violates BCNF.

A table's normal form follows from its business rules and dependencies, not its appearance. A single sample row would not show that Instructor can repeat; the additional rows make the problem visible.

Before: students A and B share Smith for DB, so Instructor determines Course without identifying a row. After: Instructor Course uses Instructor as its primary key; Student Instructor uses the composite key Student and Instructor.
Decompose Teaching into InstructorCourse and StudentInstructor. The instructor's course is stored once, and Instructor becomes the key of the table containing that fact. The split is lossless, but does not preserve every original dependency through local keys alone.

The Two BCNF Relations

InstructorCourse(Instructor PK, Course)
StudentInstructor(Student, Instructor FK)
  Primary key: (Student, Instructor)
  Foreign key: Instructor references InstructorCourse(Instructor)

This is schema notation, not executable SQL. InstructorCourse contains (Smith, DB) and (Jones, SQL). StudentInstructor contains (A, Smith), (B, Smith), and (A, Jones).

In InstructorCourse, Instructor determines Course and is the key. In StudentInstructor, neither individual attribute determines the other under these rules; the pair is the key. Both relations satisfy BCNF.

The split removes repetition of the instructor-course fact. An instructor's course can be recorded before any student is assigned, and deleting the last student assignment does not delete the instructor's course record.

Verify the Lossless Join

SELECT si.Student, ic.Course, si.Instructor
FROM StudentInstructor AS si
JOIN InstructorCourse AS ic
  ON ic.Instructor = si.Instructor;

The query reconstructs the original three rows. Instructor is common to both relations and determines all attributes of InstructorCourse, which establishes that this decomposition is lossless under the stated dependencies.

Check the Dependency-Preservation Tradeoff

The original rule (Student, Course) → Instructor spans the two resulting tables. Their primary and foreign keys alone do not enforce it. For example, adding (Lee, DB) to InstructorCourse and (A, Lee) to StudentInstructor would give A both Smith and Lee for DB without violating those local keys.

Retaining that rule requires an appropriate cross-table integrity mechanism or a carefully coordinated write procedure, with concurrency considered. Alternatively, a dependency-preserving 3NF design may be preferable. BCNF decomposition is lossless but is not always dependency preserving; it does not automatically eliminate every integrity problem.

3NF and BCNF Compared

Property Third Normal Form (3NF) Boyce-Codd Normal Form (BCNF)
Definition For every nontrivial 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
d