Database Normalization
Database normalization is the process of organizing data in a database to reduce redundancy and prevent data anomalies such as insertion, update, and deletion anomalies.
Important Terms
- X: Determinant — the left-hand side of a functional dependency.
- Y: Dependent Attribute — the right-hand side of a functional dependency.
- Proper Subset (⊂): A set that contains fewer elements than another set.
- Prime Attribute: An attribute that is part of at least one candidate key.
- Non-prime Attribute: An attribute that is not part of any candidate key.
- Super Key: One or more attributes that uniquely identify a row.
- Candidate Key: A minimal super key that uniquely identifies a row.
- FD: Functional Dependency.
- MVD: Multivalued Dependency.
- Join Dependency: A constraint where a relation can be reconstructed by joining multiple decomposed relations.
1NF: First Normal Form
- Condition: Atomic Values
- Each column must contain a single, indivisible value.
- A column should not contain multiple values in a single cell.
- Repeating groups and multivalued attributes are not allowed.
2NF: Second Normal Form
- Condition: No Partial Dependency
- The table must already be in 1NF.
- Every non-prime attribute must depend on the entire candidate key.
- A non-prime attribute must not depend on a proper subset of a composite candidate key.
- For every functional dependency
X → Y:Xmust not be a proper subset of any candidate keyK, orYmust be a Prime Attribute.
- Partial dependency exists when:
Xis a proper subset of candidate keyK, andX → Y, whereYis a non-prime attribute.
3NF: Third Normal Form
- Condition: No Transitive Dependency
- The table must already be in 2NF.
- Non-prime attributes should not depend on other non-prime attributes.
- For every functional dependency
X → Y:Xmust be a Super Key, orYmust be a Prime Attribute.
BCNF: Boyce-Codd Normal Form
- Condition: Every Determinant is a Super Key.
- The table must satisfy the requirements of 3NF.
- For every non-trivial functional dependency
X → Y,Xmust be a Super Key. - BCNF is stricter than 3NF.
4NF: Fourth Normal Form
- Condition: No Non-trivial Multivalued Dependency.
- The table must already be in BCNF.
- A non-trivial multivalued dependency
X ↠ Yshould not exist unlessXis a Super Key. - 4NF mainly deals with independent multivalued facts about the same entity.
5NF: Fifth Normal Form
- Condition: No Non-trivial Join Dependency.
- The table must already be in 4NF.
- Every non-trivial join dependency must be implied by candidate keys.
- 5NF deals with situations where a table can be further decomposed into smaller tables without losing information.
Quick Revision
- 1NF → Atomic Values
- 2NF → No Partial Dependency
- 3NF → No Transitive Dependency
- BCNF → Every Determinant is a Super Key
- 4NF → No Non-trivial Multivalued Dependency
- 5NF → No Non-trivial Join Dependency
