Boyce–Codd Normal Form (BCNF)
1.Boyce–Codd Normal Form (BCNF)
Introduction
Boyce–Codd Normal Form (BCNF) is a stronger and stricter version of Third Normal Form (3NF).
-
Every relation in BCNF is also in 3NF
-
But a relation in 3NF may not be in BCNF
BCNF was introduced because 3NF sometimes still allows certain dependencies that may cause redundancy.
2.Formal Definition of BCNF
A relation schema R is in BCNF if:
For every non-trivial functional dependency
X → A,
X must be a superkey of R.
Important Points
-
Non-trivial FD: A is not part of X.
-
Superkey: An attribute set that uniquely identifies tuples.
So BCNF rule:
If X is not a superkey, the relation violates BCNF.
3.Difference Between 3NF and BCNF
3NF Rule
A dependency X → A is allowed if:
-
X is a superkey, OR
-
A is a prime attribute
BCNF Rule
A dependency X → A is allowed only if:
BCNF removes the second condition.
Comparison Table
| Normal Form | Condition |
|---|---|
| 3NF | X is superkey OR A is prime attribute |
| BCNF | X must be superkey |
Thus BCNF is stricter.
4.Example Using LOTS Relation
Consider relation:
Assume a new dependency:
Meaning:
-
Lot area determines the county
Example assumption:
Assume the database stores thousands of land lots, but they belong to only two counties:
-
DeKalb
-
Fulton
Each county allows specific lot sizes (areas).
Allowed Lot Sizes
| County | Possible Lot Sizes (acres) |
|---|---|
| DeKalb | 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 |
| Fulton | 1.1, 1.2, 1.3, … , 1.9, 2.0 |
This means:
-
If the area of a lot is known, we can determine which county it belongs to.
Why This Creates a Functional Dependency
Because each area value belongs to only one county, the following dependency exists:
Meaning:
-
Area determines the County_name
Examples:
| Area | County_name |
|---|---|
| 0.5 | DeKalb |
| 0.7 | DeKalb |
| 1.3 | Fulton |
| 1.8 | Fulton |
So whenever we know Area, we can automatically know the County_name.
Why This Matters in Normalization
If the LOTS table has thousands of records, the same relationship will repeat many times:
Example:
| Property_id | Area | County_name |
|---|---|---|
| P1 | 0.5 | DeKalb |
| P2 | 0.6 | DeKalb |
| P3 | 1.3 | Fulton |
| P4 | 1.5 | Fulton |
The same area–county information repeats many times, causing data redundancy.
Better Design
Instead of repeating this information, we can store it in a separate relation:
AREA_COUNTY Table
| Area | County_name |
|---|---|
| 0.5 | DeKalb |
| 0.6 | DeKalb |
| 0.7 | DeKalb |
| ... | ... |
| 1.9 | Fulton |
| 2.0 | Fulton |
There are only 16 possible area values, so this table would contain just 16 rows, instead of repeating the same information in thousands of rows.
Key Idea
Because Area uniquely determines County_name, the dependency
exists.
This dependency violates BCNF because:
-
Area is not a superkey
-
Yet it determines another attribute.
Therefore, BCNF suggests decomposing the relation to remove redundancy.
Why LOTS1A is Still in 3NF
Dependency:
Check 3NF conditions:
| Condition | Result |
|---|---|
| Area is superkey | ❌ No |
| County_name is prime attribute | ✅ Yes |
Since County_name is part of candidate key, 3NF allows this dependency.
But BCNF Rejects It
BCNF requires:
But:
Therefore LOTS1A violates BCNF.
5. BCNF Decomposition
To remove the BCNF violation, split the relation.
Relation 1
Dependency:
Relation 2
Now both relations satisfy BCNF.
6. Functional Dependency Loss
One problem with BCNF decomposition:
Some functional dependencies may be lost.
Example:
After decomposition:
-
These attributes may not exist together
-
So the dependency cannot be enforced directly
Thus BCNF may lose dependency preservation.
7. Example: TEACH Relation
Relation:
Functional dependencies:
Candidate Key
Check 3NF
Dependency:
-
Instructor is not a superkey
-
Course is prime attribute
Thus 3NF allows it.
So relation is in 3NF.
But It Violates BCNF
Because:
Instructor is not a superkey.
So BCNF is violated.
8. Possible Decompositions
To achieve BCNF, the relation must be decomposed into smaller relations.
Possible decompositions:
Option 1
Option 2
Option 3
9. Problem: Functional Dependency Loss
All three decompositions lose FD1:
Because the attributes Student, Course, Instructor are no longer together in one table.
However, during normalization two properties must be considered:
-
Lossless (Nonadditive) Join
-
Dependency Preservation
If we must choose, lossless join is mandatory.
10. Nonadditive Join (Lossless Join)
A decomposition is lossless if the original table can be reconstructed without creating incorrect tuples.
To test this, we use the Nonadditive Join Test for Binary Decompositions(NJB).
11. NJB Test Rule
For decomposition:
The join is lossless if:
12. Apply NJB Test
For Option 3 ( other two fails)
Relations:
Common attribute:
So:
Check:
This dependency exists (FD2).
Therefore the NJB condition is satisfied.
So Option 3 gives a lossless decomposition.
12. Final BCNF Relations
The correct decomposition is:
TEACH1
TEACH2
These relations are in BCNF.
13. BCNF Decomposition Procedure
General method:
-
Find a functional dependency that violates BCNF.
-
Suppose:
-
Decompose relation R into:
-
Check each relation again.
-
Repeat until all relations are in BCNF.
14. Important Observation
If we choose (Student, Instructor) as the primary key:
Then dependency:
creates a partial dependency.
This can also be removed during 2NF normalization.
So sometimes different normalization paths lead to the same final BCNF design.


Comments
Post a Comment