
Normalization in DBMS
- Normalization is a process of decomposing a table into more than one table.
- We need to normalize a table i.e. reduce a table into more tables just to remove insert anomalies, update anomalies.
- It is also used to minimize the redundancy in a table.
- Basically normalization divides larger table into smaller table and establish relationship between them.
- Before moving into normalization depth we must know about functional dependency. Functional dependency states how one column is dependent upon another column.
- While normalizing a table we must keep in mind that the dependency should be preserved.
Types of Normal form
- 1NF
- In 1NF multi valued and composite attributes are not allowed.
- For example — suppose we have a table where there is a column of mobile number and a person can have more than one mobile number. Then there will be need to decompose that table in 1NF. - 2NF
- The relation should be in 1NF.
-In 2NF we need to eliminate partial dependency from table.
- Partial dependency happens when a part of key gives a non key. Suppose AB →C (AB is Key)
B → C ( B is part of key gives non key element)
This is known as partial dependency.
- For lossless decomposition the common attribute should be a key in either of table. - 3NF
- The relation should be in 2NF.
- In 3NF we eliminates the transitive dependency and it is used to remove data duplication.
- Transitive Dependency occurs when a dependency has no key i.e.
L.H.S (non-key)→R.H.S (non-key). For example:
A (Key)→B
B →C
C is dependent on B and non of B or C is key. - BCNF
- Any relation will be in BCNF if it is in 3NF.
- For a relation to be in BCNF if for functional dependency the L.H.S is a super key.
For example : Suppose the dependency are
AB (Key)→C
C →B
So, we must decompose the table in such a way that AC becomes key.