Definition
A relation is in Third Normal Form (3NF) if, for every non-trivial and decomposed FD , at least one of the following holds:
- X is a superkey, or
- Each attribute in Y is a prime attribute (i.e., appears in some candidate key)
Note
- β 3NF allows certain non-superkey dependencies if RHS is βsafeβ
- β Violates 3NF if a non-superkey determines a non-prime attribute β possible redundancy
3NF Checking Algorithm (Conceptual)
- Derive candidate keys of the relation.
- For each non-trivial, decomposed FD:
- Check if LHS is a superkey, OR
- All RHS attributes are prime
- If all FDs satisfy either condition β relation is in 3NF
Tip
3NF is more lenient than BCNF:
- All BCNF relations are in 3NF
- Not all 3NF relations are in BCNF
Pros and Cons
3NF Pros
- Reduces redundancy (though not as much as BCNF)
- Ensures lossless join
- Preserves all functional dependencies
3NF Cons
- May still allow some redundancy
- Possible update/delete anomalies in rare edge cases
3NF Decomposition Algorithm
Goal: Decompose to 3NF while preserving all FDs
Step-by-step:
- Compute a minimal basis (aka canonical cover) for the set of FDs.
- Group FDs with the same LHS.
- Create one relation for each FD group:
- Each relation contains LHS βͺ RHS
- Ensure at least one relation contains a candidate key of the original relation.
- If not, add a separate relation containing any candidate key.
- Remove redundant relations (i.e., subset of another relation).
Note
Decomposition is single-layer and linear. All FDs in minimal basis will be preserved.
Minimal Basis / Minimal Cover
A minimal basis is a simplified, equivalent set of FDs that satisfies:
- All FDs are non-trivial and decomposed (RHS is a single attribute)
- No FD can be removed without losing information
- No attribute in any LHS is redundant
Minimal Basis Algorithm
- Decompose all FDs: ensure RHS is single-attribute
- Minimize LHS:
- Try removing each attribute in LHS
- If closure of remaining attributes still gives RHS β attribute is redundant
- Remove redundant FDs:
- Try removing each FD
- If remaining FDs can still derive it β itβs redundant
Trick
If all FDs have different RHS attributes, none can be removed in step 3.