To create a database that demonstrates all these normalization forms (UNF, 1NF, 2NF, 3NF, EKNF, BCNF, 4NF, ETNF, 5NF, DKNF, 6NF), we need a step-by-step approach where each normalization form builds on the previous one. Below is an outline of a database structure that transitions through these forms:
- Definition: Data is stored without any normalization; it may contain repeating groups or arrays.
- Example Table: Orders
OrderID CustomerName Products Quantities 1 Alice [Apple, Orange] [2, 3] 2 Bob [Banana, Grape, Apple] [1, 2, 1]
- Definition: Remove repeating groups; each column contains atomic values.
- Example Table: Orders
OrderID CustomerName Product Quantity 1 Alice Apple 2 1 Alice Orange 3 2 Bob Banana 1 2 Bob Grape 2 2 Bob Apple 1
- Definition: Remove partial dependencies; every non-prime attribute must be fully functionally dependent on the primary key.
- Split into Tables:
-
Orders:
OrderID CustomerName 1 Alice 2 Bob -
OrderDetails:
OrderID Product Quantity 1 Apple 2 1 Orange 3 2 Banana 1 2 Grape 2 2 Apple 1
-
- Definition: Remove transitive dependencies; non-prime attributes should not depend on other non-prime attributes.
- Split into Tables:
-
Customers:
CustomerID CustomerName 1 Alice 2 Bob -
Orders:
OrderID CustomerID 1 1 2 2 -
OrderDetails:
OrderID ProductID Quantity 1 1 2 1 2 3 2 3 1 2 4 2 2 1 1 -
Products:
ProductID ProductName 1 Apple 2 Orange 3 Banana 4 Grape
-
- Definition: Resolve overlapping candidate keys. Every determinant is a candidate key.
- Example: Ensure that no anomalies exist in composite keys and resolve redundancy in keys by revisiting dependencies.
- Definition: Eliminate multi-valued dependencies.
- Split Example:
-
Orders:
OrderID CustomerID 1 1 2 2 -
ProductsOrdered:
OrderID ProductID 1 1 1 2 2 3 2 4 2 1 -
ProductQuantities:
ProductID OrderID Quantity 1 1 2 2 1 3 3 2 1
-
- Definition: Resolve join dependencies; ensure the database is decomposed into tables that can be recombined without loss of data.
- Example: Further splitting based on multi-valued facts.
- Definition: Ensure constraints are represented explicitly by domains and keys.
- Example: Add checks on columns (e.g.,
Quantity > 0
,ProductName is unique
).
- Definition: Decompose tables into irreducible components; applied in temporal databases to handle time-variant data.
- Example:
- OrderTime:
OrderID ProductID Quantity StartDate EndDate 1 1 2 2024-01-01 2024-02-01 1 2 3 2024-01-01 2024-02-01
- OrderTime:
Each step introduces stricter requirements to minimize redundancy and ensure consistency. The database evolves to become more efficient but often requires more tables and joins for complex queries.