0% found this document useful (0 votes)
16 views

Normalization

Normalisation

Uploaded by

Saugat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Normalization

Normalisation

Uploaded by

Saugat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Normalization

-Santosh Bajgain
Definition
• Data normalization is a process of presenting a database in a normal form to
avoid undesirable things such as repetition of information, inability to
represent information, loss of information, etc. It improves performance by
reducing data redundancy to a large extent.
• Or
• Normalization is a database design technique that reduces data redundancy
and eliminates undesirable characteristics like Insertion, Update and
Deletion Anomalies. Normalization rules divide larger tables into smaller
tables and links them using relationships. The purpose of Normalization in
SQL is to eliminate redundant (repetitive) data and ensure data is stored
logically.
• The inventor of the relational model Edgar Codd, proposed the theory of
normalization of data with the introduction of the First Normal Form, and he
continued to extend the theory with the Second and Third Normal Forms.
Later he joined Raymond F. Boyce to develop the theory of the Boyce-Codd
Normal Form.
Advantages of Normalization
• It reduces data redundancy.
• It improves faster sorting and index creation.
• It creates a few indexes and nulls.
• It ignores the repetition of information.
• It simplifies the structure of tables
• It improves the performance of a system.
• It avoids the loss of information.
Need of normalization
The table is a basic building block in the database design process. So, the
structure of the table is the great interest in relational database design. A poor
table structure degrades the performance of the RDBMS. So, recognizing a
poor table structure and producing a good table is based on normalization.
Normalization is a process for assigning attributes to entities. Normalization
reduces data redundancies and helps to eliminate the data anomalies in a
database Normalization does not eliminate data redundancies. Instead, it
produces a controlled mechanism to reduce the repetition of data that lets us
link database tables. So, normalization is the process of decomposing a big
table into much smaller and simplest.
The need for normalization in point wise listed as:
1) It eliminates redundant data.
2) It reduces the chances of data error.
3) Normalization is important because it allows the database to take up less disk space.
4) It also helps in increasing performance.
5) It improves data integrity and consistency.
Types
• The most important and widely used normal forms are:
• First Normal Form (INF)
• Second Normal Form (2NF).
• Third Normal Form (3NF) Boyce Codd Normal Form (BCNF)
• Fourth Normal Form (4NF).
A relation is said to be in particular normal form if it satisfies a
prescribed set of rules.
From structure view point 1NF is better than 2NF and 2 NF is better
than 3 NF.
1NF • A relation or table is said to be in 1NF if all attribute is atomic.
• That is, there should not be any repeating group of an attribute.
• Purpose of 1NF
• To eliminate the repeating group of attributes in an entity
• In other words,
• If any character is repeated again and again in the same table/row, then
such attributes are either removed to a separate table or decomposed to
several rows

1NF (First Normal Form) Rules


•Each table cell should contain a single value.
•Each record needs to be unique.
Table: student
Example of 1NF Roll Name Class Subject Marks

15 Sushant XII Eng 50


Table: student
15 Sushant XII math 95
Roll Name Class Subjec Marks
t 15 Sushant XII nep 60

15 Sushant XII Eng 50 16 Raman XI Eng 52


Math 95
Nepali 60 16 Raman XI Comput 45
16 Raman XI Eng 52 er
Compu 45 16 Raman XI account 67
ter 67
account

Unnormalized Table Normalized Table in 1NF


Classwork
the following table to 1NF
• A relation is said to be in second normal form if it is in first normal
form and each attribute is functionally dependent on the entire primary
2NF key.
• The purpose of the Second Normal form is to eliminate partial key
dependencies.
• In other words, each attribute in the table must depend on the whole
key, not just the part of it.
• For example, in the above table, the primary key is the combination of
'Roll_No +Class’.
• The dependencies of other attributes on this primary key:
• The Name depends on Roll No and Class
• Subject depends only on Class, not on Roll_No
• Marks depends on Subject and Name
• So, the above table can be decomposed into the following tables
2NF (Second Normal Form) Rules
•Rule 1- Be in 1NF
•Rule 2- Single Column Primary Key that does not functionally depend on any subset
of candidate key relation
Changing above student table to 2NF
Class Subject
Name subject Marks
XII Eng
Sushant Eng 50
Roll Name Class XII math
Sushant math 95
15 Sushant XII XII nep
Sushant nep 60
16 Raman XI
XI Eng
Raman Eng 52
Table: student
XI Computer
Raman Computer 45
XI account
Raman account 67
Table: student
Table: Marks
3NF
• A relation is in 3NF if
• It is in 2NF and
• Doesn’t contain any transitive dependency on the primary key
• All the attributes that do not depend upon the Primary key need to be
eliminated.
• A transitive dependency is that in which among 3 attributes A, B, and C, if
A->B, B->C then C->A.

3NF (Third Normal Form) Rules


•Rule 1- Be in 2NF
•Rule 2- Has no transitive functional dependencies
To move our 2NF table into 3NF, we again need to again divide our
Changing above student table to 3NF
Student_I Sub_id Marks
Sub_ID Subject D
E01 Eng 1 T04 50
Studen Roll Name Class_Id
t_ID E02 math 1 T05 95
1 15 Sushant 11 1 T06 60
E03 nep
2 16 Raman 12
T04 Eng 2 E01 52
Table: student 2 E02 45
T05 Computer

T06 account 2 E03 67


Class_Id Class
11 XII Table: Marks
Table: student
12 XI
Table: class
Classwork
the following table to 1NF
solutions
Example-3
• Normalize the following table to 1NF,2NF, and to 3NF

E_code dept Dept_head Project code hours


E_105 sales E_320 P123 90hrs
E_106 P124 70hrs
E_111 P111 110hrs
E_136 finance E_312 P208 45hrs
E_125 P80 34hrs
E_112 P60 120hrs
E_106 Admin E_132 P132 78hrs
E_108 E_136 92hrs
Last example
Teacher address Age Owned degree subject
Santosh Damak-3 28 M.Sc.CS Microprocessor,
Bajgain Optical network,
Numerical method
Abinash Jha Damak-6 37 MCA E-commerce,
DBMS,
Project-I
Pradip Ghimire Gauradha 26 MCA JAVA,
ADJVA,
PYTHON

You might also like