DB Normalization is the process of organizing the columns and fields of a relational table to minimize the redundancy,complexity and dependency.
First Normalization Form( 1NF ) :
A table is said to be in 1nf when there are no repeating groups or no repeating elements present.
Second Normalization Form ( 2NF):
A table is in 2NF if
a) the table satisfies the 1NF
b) no partial dependencies on the primary key(may be compound primary key) [ remove subsets of data that apply to multiple rows of a table and place them in separate tables supplied with foreign key relation ]
Third Normalization Form(3NF)
A table is in 3NF if
a)already satisfied the 2NF
First Normalization Form( 1NF ) :
A table is said to be in 1nf when there are no repeating groups or no repeating elements present.
Second Normalization Form ( 2NF):
A table is in 2NF if
a) the table satisfies the 1NF
b) no partial dependencies on the primary key(may be compound primary key) [ remove subsets of data that apply to multiple rows of a table and place them in separate tables supplied with foreign key relation ]
Third Normalization Form(3NF)
A table is in 3NF if
a)already satisfied the 2NF
b) all the attributes should be directly dependent on the primary key
Example:
Let's try normalizing the following table
1nf :remove the attributes which are redundant class_1,class_2,class_3 in the above table and bring it on as below
2nf: No partial dependency of non-key attributes on the primary key and remove subsets of data consolidated as tables with foreign key relation
Considering student_id and Mentor as compound primary key, class is not a full dependent on the composite py key and on segregating will result in the tables as follows
Add caption |
3Nf : all the attributes should be directly dependent on the primary key
In the STUDENT_ID,MENTOR AND MENTOR_ROOM table mentor_room is no way dependent on the student_id which is the py key so on consolidating
Thanks for Reading.... cheers :-) :-)