MySQL

adplus-dvertising
Normalization in MySQL
Previous Home Next

It is a technique in which we are decomposing the existing data into different tables which reduces the redundency and undesirable characteristics like insertion, updation , deletion operation performed in database.

Normalization of database means we are normalizing the given database.It mainly used for two purpose only, they are:

  1. Eliminating the redundent(useless) data from the database.
  2. Data is stored in different table in should be relevant and make dependencies i.e. all data is logically stored

Normalization have the following rules that divides it into the form known as Normal Form, they are:

  1. First Normal Form
  2. Second Normal Form
  3. Third Normal Form
  4. BCNF

First Normal Form(1NF)

In this nomal form, no two row or columns have the same data element i.e. each set of column must have the unique value. in this normal form data redundency get increases as there are many columns have the same data into their columns but each row should be unique.

example

In this we are having the details of student in the database table of a school, we are appllying the 1NF as defined in the below table view

StudentageAddress
Arun 24Saket
Kuldeep 23Malviya Nagar
Hemant 24Gurgaon
Prasant 24Kotla
Gaurav 25Laxmi Nagar

Second Normal Form(2NF)

In this normal form, the data which is already stored in 1NF, its all attributes within the table should be solely dependent in the unique identity of that entity.

example

In this we are applying the 2NF in the above define table , we are decomposing the table into twop tables like Student table and Address table as below

Student table

Studentage
Arun 24
Kuldeep 23
Hemant 24
Prasant 24
Gaurav 25

Address table

StudentAddress
Arun Saket
Kuldeep Malviya Nagar
Hemant Gurgaon
Prasant Kotla
Gaurav Laxmi Nagar

Third Normal Form

In this normal form, we are providing the non-prime attribute of each table must be dependent on the Primary key. In this we are creating the transitive dependencies which help in data integrity.

example

In the above table define in 2NF we are giving the primary key to each table and assign dependency on it.

Student table

Student_idStudentage
101Arun 24
102Kuldeep 23
103Hemant 24
104Prasant 24
105Gaurav 25

Address table

Address_idStudentAddress
201Arun Saket
202Kuldeep Malviya Nagar
203Hemant Gurgaon
204Prasant Kotla
205Gaurav Laxmi Nagar

Boyce-Codd normal form (BCNF)

This is the highest version of 3NF, it is based on the concept of Determinant, in which some attribute is fully functionaly dependent. The relation in a bcnf if and only if every determinant is a candidate key.

Previous Home Next