Normalization Example
Normalization Example
Issues:
Changes:
The multiple products for each order are now split into separate rows,
ensuring atomicity (single values in each cell).
OrderID repeats for each product in the order, but that's fine in 1NF.
Solution:
We need to separate the order-specific data into a separate table so
that ProductID is linked only to OrderID and ProductID.
Orders Table:
Products Table:
OrderDetails Table:
OrderID ProductID
O001 P001
O001 P002
O002 P003
O003 P002
O003 P004
Changes:
Issues in 2NF:
In the Products Table, ProductName and ProductPrice are dependent
on ProductID, but ProductName and ProductPrice are directly related
to each other. This is a transitive dependency.
Solution:
We separate the ProductPrice from ProductName into another table,
ensuring that ProductName and ProductPrice are only dependent
on ProductID.
Products Table:
ProductID ProductName
P001 Laptop
P002 Mouse
P003 Smartphone
P004 Keyboard
ProductPrices Table:
ProductID ProductPrice
P001 1000
P002 20
P003 800
P004 50
We moved ProductPrice to a separate table called ProductPrices,
ensuring that it is only dependent on ProductID and eliminating
transitive dependencies.