Definition
A relation is in BCNF if, for every non-trivial and decomposed functional dependency , the LHS (X) is a superkey of .
Note
- β All RHS attributes must depend only on superkeys
- β If RHS depends on non-superkey β LHS can repeat β Redundancy arises
BCNF Checking Algorithm (Conceptual)
- List all non-trivial and decomposed FDs.
- Check if each FD has a superkey on its LHS.
- If all FDs pass this test, then the relation is in BCNF.
Shortcut: βMore but not allβ condition
If any closure of a subset X yields more than X but not all attributes of R, then: β’ X is not a superkey β’ Hence, violates BCNF
This condition helps you avoid checking all FDs manually.
Pros and Cons
BCNF Pros
- Eliminates update, insertion, and deletion anomalies
- Reduces redundancy
- Lossless join: Original table can be reconstructed from decomposed tables
BCNF Cons
- FDs may not be preserved after decomposition. Enforcing original constraints may no longer be possible directly.
BCNF Decomposition Algorithm
Goal: Remove BCNF violations recursively
Step-by-step:
- Find such that satisfies βmore but not allβ condition
- Decompose R into:
- Repeat this process on Rβ and Rβ recursively, using projected FDs
Note
Each decomposition removes at least one BCNF violation.
- Final result is not unique β depends on order of choices
- If a relation has only 2 attributes, it is always in BCNF
Example
Given:
- Relation:
- Functional Dependencies (FDs):
Step 1: Find violating FD β More than A, but not all β violates BCNF
Step 2: Decompose R
- (attributes in )
- ( + rest)
Step 3: Check BCNF
- : No violating FD β β
- : , but is not a superkey β β
Step 4: Decompose R1
- B+ = {B, C} β violates BCNF
Decompose:
- R3(B, C)
- R4(A, B)
β Final BCNF Tables:
- R2(A, D)
- R3(B, C)
- R4(A, B)
Closure Projection for Decomposition
When decomposing into and :
- To find the FDs for , use the original FDs but ignore attributes not in
- Do the same for
Lossless Join Property
To verify that decomposition is lossless:
- Compute common attributes of the decomposed tables
- Check if the closure of those attributes contains all attributes of one of the relations
Note
- If yes β lossless join is guaranteed
- Also can test: does natural join of all decompositions yield the original relation?
Dependency Preservation
Let:
- = original set of FDs
- = FDs preserved across all decomposed tables
To check if dependency is preserved, confirm β²,
- For every FD in , can it be derived from β²?
- For every FD in β², can it be derived from ?
Trick
If a decomposed relation contains all attributes of and , then is preserved in that relation.
Dependency Preservation Algorithm
- For each decomposed relation , compute closure of all subsets of attributes
- Find all implied FDs in
- Combine them to form β²
- Check if and β² are equivalent