Normalization
Normalization
It is the process to present a database in a normal form to avoid undesirable things such as repetition of information, inability to represent information, loss of information, etc. It reduces data redundancies and, by extension, helps to eliminate the anomalies that result from these redundancies.
Advantages of Normalization
- Reduces data redundancy.
- Improves faster sorting and index creation.
- Ignores the repetition of information.
- Simplifies the structure of tables.
- Improves the performance of a system.
- Avoids loss of information.
Disadvantages of Normalization
- You cannot start building the database before you know what the user needs.
- On Normalizing the relations to higher normal forms i.e. 4NF, 5NF the performances degrades.
Types of Normalization
Databases can be classified by their level of normalization, they are as follows:
- A table or a relation is said to be in 1NF if it is atomic, i.e., it shouldn’t contain any repeating group in any row or column of the table. Each of the tables has only one value.
Mem_code |
Mem_name |
Class |
B_code |
B_name |
Issue_date |
Date_due |
M01 |
Sarita |
12 |
B012 |
C++ |
14/02/2022 |
15/02/2022 |
M02 |
Krishna |
11 |
B014 |
C |
11/02/2022 |
12/02/2022 |
|
|
|
B029 |
Comp |
11/02/2022 |
12/01/2022 |
M03 |
Sarala |
11 |
B049 |
English |
14/02/2022 |
15/02/2022 |
Fig: Un-normalized form
Mem_code |
Mem_name |
Class |
B_code |
B_name |
Issue_date |
Date_due |
M01 |
Sarita |
12 |
B012 |
C++ |
14/02/2022 |
15/02/2022 |
M02 |
Krishna |
11 |
B014 |
C |
11/02/2022 |
12/02/2022 |
M02 |
Krishna |
11 |
B029 |
Comp |
11/02/2022 |
12/01/2022 |
M03 |
Sarala |
11 |
B049 |
English |
14/02/2022 |
15/02/2022 |
Fig: Normalized form |
|
|
|
|
|
|
- A table or a relation is said to be in 2NF if it is in 1NF, and each attribute is functionally dependent on the primary key. The purpose of 2NF is to eliminate partial key dependencies. To convert the table in 1NF into 2NF, the attributes which are not functionally dependent on the primary key are decomposed into separate tables.
Mem_code |
Mem_name |
Class |
M01 |
Sarita |
12 |
M02 |
Krishna |
11 |
M03 |
Sarala |
11 |
Fig: Member Table |
|
|
B_code |
B_name |
Issue_date |
Date_due |
B012 |
C++ |
14/02/2022 |
15/02/2022 |
B014 |
C |
11/02/2022 |
12/02/2022 |
B029 |
Comp |
11/02/2022 |
12/01/2022 |
B049 |
English |
14/02/2022 |
15/02/2022 |
Fig: Book Table |
|
|
|
- A table or a relation is said to be in 3NF if it is in 2NF and transitive dependency doesn’t exist. All attributes that are not dependent upon the primary key must be eliminated. A transitive dependency is the one in which, among 3 attributes A, B, and C, if A->B, B->C, then C->A. This dependency must be eliminated for a table to be in 3NF.
Mem_code |
Mem_name |
Class |
M01 |
Sarita |
12 |
M02 |
Krishna |
11 |
M03 |
Sarala |
11 |
Fig: Member Table |
|
|
B_code |
B_name |
B012 |
C++ |
B014 |
C |
B029 |
Comp |
B049 |
English |
Fig: Book Table |
|
Mem_code |
B_code |
Issue_date |
Date_due |
M01 |
B012 |
14/02/2022 |
15/02/2022 |
M02 |
B014 |
11/02/2022 |
12/02/2022 |
M02 |
B029 |
11/02/2022 |
12/01/2022 |
M03 |
B049 |
14/02/2022 |
15/02/2022 |
Fig: Issue Table |
|
|
|