Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
25 views

SQL Unit2 NORMALIZATION

The document discusses database normalization techniques which help reduce data redundancy and inconsistencies. Normalization divides tables, links them using relationships and eliminates anomalies like insertion, deletion and update anomalies. The document also explains different normal forms from 1NF to 5NF.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

SQL Unit2 NORMALIZATION

The document discusses database normalization techniques which help reduce data redundancy and inconsistencies. Normalization divides tables, links them using relationships and eliminates anomalies like insertion, deletion and update anomalies. The document also explains different normal forms from 1NF to 5NF.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

NORMALIZATION

Normalization is a database design technique that reduces data


redundancy and eliminates undesirable characteristics like Insertion,
Update and Deletion Anomalies.
Normalization rules divides larger tables into smaller tables and links them
using relationships.
The purpose of Normalisation in SQL is to eliminate redundant (repetitive)
data and ensure data is stored logically.
Why we need Normalization in DBMS?
Normalization is required for,
• Eliminating redundant(useless) data, therefore handling data
integrity, because if data is repeated it increases the chances of
inconsistent data.
• Normalization helps in keeping data consistent by storing the data
in one table and referencing it everywhere else.
• Storage optimization although that is not an issue these days
because Database storage is cheap.
• Breaking down large tables into smaller tables with relationships, so
it makes the database structure more scalable and adaptable.
• Ensuring data dependencies make sense i.e. data is logically
stored.
Anomalies in DBMS
Anomalies in DBMS can be defined as the flaws or problems in the
relational database that can be occurred by the operations such as some
instances of insertion leading to insertion anomalies in DBMS, deleting
rows that can lead to deletion anomalies in DBMS and updating rows that
can lead to updating anomalies.
Insertion Anomaly:
It occurs when you insert a data record as a row but the information is not
available for all the columns, causing null values in a row.
Consider the table,
Student_id Name Dept_No DName Faculty_id Salary
10 Smitha 101 BDA 1 40000
11 Adithya 101 BDA 1 40000
12 Naveen 102 BCom 2 50000
13 Deepna 102 BCom 2 50000
NULL NULL 103 BSc NULL NULL

If a new department is introduced say with Dept_No=3, but with no


students and faculty yet. Here, null values for rest of the attributes are not
allowed. Moreover, Student_id is a primary key, that doesn’t allow null
value.
In other words, it is impossible to write data about one entity to the
database without specifying data about another entity.
Deletion Anomaly
The deletion anomaly arises while deleting data from a table with a
considerable amount of data loss is called a deletion anomaly in DBMS.
Consider the table,
Student_id Name Dept_No DName Faculty_id Salary
10 Smitha 101 BDA 1 40000
11 Adithya 101 BDA 1 40000
12 Naveen 102 BCom 2 50000
13 Deepna 102 BCom 2 50000
14 Lokesh 103 BSc 3 60000
If Student_id=14 is deleted, the complete information regarding the
department and faculty are lost.
To retain information, the above table can be split into 3 tables, Student,
Department and Faculty. This will avoid losing precious data.
Updation Anomaly
The Updation anomaly occurs when duplicate data exists in the database
table. The duplicate data need to be modified for all tuples to maintain the
consistency.
Consider the table,
Student_id Name Dept_No DName Faculty_id Salary
10 Smitha 101 BDA 1 40000
11 Adithya 101 BDA 1 40000
12 Naveen 102 BCom 2 50000
13 Deepna 102 BCom 2 50000
14 Lokesh 103 BSc 3 60000

If any one of the attribute values need to be updated, say Salary of the
Faculty_id=1 to 50000. It has to be changed for all other corresponding
tuples to maintain consistency.
Normalization works through a series of stages called Normal forms. The
normal forms apply to individual relations. The relation is said to be normal
form if it satisfies constraints.
Types of Normal Forms:
Following are the various types of Normal forms:

Normal Description
Form

1NF A relation is in 1NF if it contains an atomic value.

2NF A relation will be in 2NF if it is in 1NF and all non-key attributes are fully
functional dependent on the primary key.

3NF A relation will be in 3NF if it is in 2NF and no transition dependency exists.

BCNF BCNF is a stricter form of 3NF that ensures that each determinant in a table is a
candidate key. In other words, BCNF ensures that each non-key attribute is
dependent only on the candidate key.

4NF A relation will be in 4NF if it is in Boyce Codd's normal form and has no multi-
valued dependency.

5NF A relation is in 5NF. If it is in 4NF and does not contain any join dependency,
joining should be lossless.

You might also like