Normalization: Removing Duplicates is called Normalization.
Example: The above table is not normalized.
Problems with Duplicate data:
To solve this, we normalize tables. We have broken the above table into 2 tables, repeating columns we have moved into a separate table and we don’t have to repeat DName, DHead, DLocation in the Employees Table all we do here refer Did. And we have given the primary key to Did to uniquely identify each department in the Department table.
Read More: Different Types of SQL Keys
There are 6 normal forms: 1NF,2NF,3NF,4NF,5NF,6NF. Most databases are in 3NF. There are certain rules that each normal form follows
Read More: Different Type of SQL Joins
First Normal Form(1NF) A table is said to me 1NF, if
|Finance||Chris, Mary, Den|
Because of multiple values in the above example Insert, Update, Delete is not possible for one Employee.
Suppose HR department has only one employee, EName2 and EName3 columns have null values in that case, wastage of the disk space.
Here, DId is the Primary key in the Table1 and DId is the Foreign key in the Table2, which satisfies 1NF.
Read More: Different Types of SQL Database Functions
Second Normal Form(2NF)
DId is Primary key in Department table and DId in Employee table is Foreign key (Added additional column to make sure the two tables have relationship).
Read More: Different Types of SQL Injection
Third Normal Form(3NF)
Example: Employee Table
Annual Salary is not fully dependent on Primary key because Annual Salary Column depends on Salary column.
Fourth Normal Form(4NF)
Example: Course, Lecture, Books
|Divides data into multiple tables so, data retrieval is slow||Data from multiple tables are divided into single table so, data retrieval is fast|
|Reduce duplicate data||Create duplicate data|
|Because of more tables, we use more joins||Less tables less joins|
JanBask Training is a leading Global Online Training Provider through Live Sessions. The Live classes provide a blended approach of hands on experience along with theoretical knowledge which is driven by certified professionals.
Course for testing
Receive Latest Materials and Offers on SQL Server Course