0% found this document useful (0 votes)
6 views7 pages

DEMO Normalization1

Uploaded by

mohansai3656
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)
6 views7 pages

DEMO Normalization1

Uploaded by

mohansai3656
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/ 7

NORMALIZATION IN DBMS | normal forms | 1nf, 2nf, 3nf, BCNF, 4nf, 5nf normal forms:

Normalization is the Process of Organizing the data and the attributes of a database.

Stud ID Stud Name Couse Specialization


501 Raja BSc Physics, Maths
502 Suja BCom Civics
503 Suresh BBA Sanskrit, Art
504 Manisha BA Economics
505 Kamal BL HR Laws

To avoid Insertion Anomaly, Updation Anomaly and Deletion Anomaly


Function Dependency: It is relationship that exist between two sets of attributes
of a relational table where one set of attributes can determine value of other set
of attributes. X → Y
Here, ‘X’ determinant and ‘Y’ is dependant.
1. 1NF : In 1NF relation each table cell should contain a single value. Each
records looks unique.
Stud ID Stud Name Stud Age Specialization
(Primary Column) (Non-Primary Column) (Non-Primary Column) (Non-Primary Column)

501 Raja BSc Physics, Maths


502 Suja BCom Zoology
503 Suresh BBA Sanskrit, Art
504 Manisha BA Economics
505 Kamal BL HR Laws

Here, in Game row, there are two games in one single cell. So it is “multi
valued attribute”. This is not acceptable in 1NF, and should be eliminated
to convert into 1NF.
Stud ID Stud Name Course Subject
501 Raja BSc Physics
501 Raja BSc Maths
502 Suja BCom Zoology
503 Suresh BBA Sanskrit
503 Suresh BBA Art
504 Manisha BA Economics
505 Kamal BL HR Laws
(If primary key has duplicates, that is known as partial dependency, that should avoided to fulfil the 2NF’s criteria)
This is simple method to store game separately in 1NF. Now, this becomes
1NF. 1NF wants to maintain Atomic Property ie., stores one value in each
cell.
2NF: In 2NF relation must be in 1NF. In 2NF, all Non-Key Attributes are
fully functional dependent on the Primary Key.
Stud ID Stud Name Course Subject
(Primary Attribute) (Non-Primary Attribute) (Non-Primary Attribute) (Non-Primary Attribute)
501 Raja BSc Physics
501 Raja BSc Maths
502 Suja BCom Zoology
503 Suresh BBA Sanskrit
503 Suresh BBA Art
504 Manisha BA Economics
505 Kamal BL HR Laws
• It also in 1NF from and every non-Primary attribute should depend
on Primary Key.
• Creating 1 table to remove the partial dependent column & to
maintain the Primary Key for the table and 2nd table for the partial
dependent column.
• Now, there is no duplicate records as well.
• The following tables are satisfying the conditions of 2NF relation.

Stud ID Stud Name Course


501 Raja BSc
502 Suja BCom
503 Suresh BBA
504 Manisha BA
505 Kamal BL
(consider only the above table and need not consider the second table at 2NF)
Stud ID Subject
501 Physics
501 Maths
502 Zoology
503 Sanskrit
503 Art
504 Economics
505 HR Laws
3NF: The relation in 3NF, if it is in 2NF and no transition dependency exist.
Non-Primary attribute is dependent on the Primary Key.
(Stud ID Course  Fee and So, we can say Fee is also depending on Stud ID. This is Transition Dependency)

Stud Name Stud ID Course Fee


(Non-Primary Column) (Primary Column) (Non-Primary Column) (Non-Primary Column)

Raja 501 BSc 5000


Suja 502 BCom 4000
Suresh 503 BBA 7000
Manisha 504 BA 6000
Kamal 505 BL 8000

(The arrows shows the dependency. Fee(a non primary) is dependent on


Course(another non primary attribute). One Non-primary is depending on
another non-primary attribute is a Transitive Dependency. This should be
avoided to satisfy the 3NF)
Stud Name Stud ID Course
(Non-Primary Column) (Primary Column) (Non-Primary Column)

Raja 501 BSc


Suja 502 BCom
Suresh 503 BBA
Manisha 504 BA
Kamal 505 BL
(This is a 3NF relation)
And a separate table below for transitive dependent attributes.
Course Fee
(Non-Primary Column) (Non-Primary Column)

BSc 5000
BCom 4000
BBA 7000
BA 6000
BL 8000

Understanding the Concept


In simpler terms, let's say we have three attributes: A, B, and C.
• A determines B: The value of B depends solely on the value of A.
• B determines C: The value of C depends solely on the value of B.
From these two dependencies, we can infer that:
• A determines C: This is a transitive dependency because the relationship between A
and C is indirect, mediated through B.)
4. BCNF (Boyce-Codd Normal Form)
• BCNF is next part of 3NF
• Table must be in 3NF
• In BCNF, Every function dependency X → Y, here ‘X’ is a Super
Key of the table
If any non primary column is depending on another non-primary attribute, that
must be a super key to fulfil the BCNF. The BCNF eliminates redundancy in
course column in the below table.

Stud Name Stud ID Course Fee


(Non-Primary Column) (Primary Column) (Non-Primary Column) (Non-Primary Column)

Raja 501 BSc 5000


Suja 502 BCom 4000
Suresh 503 BBA 7000
Manisha 504 BA 6000
Kamal 505 BL 8000
Lakshmi 506 BSc 5000

Here, Stud Name is depending on a super key and this is in


BCNF relation
Stud Name Stud ID
(Non-Primary Column) (Primary Column)

Raja 501
Suja 502
Suresh 503
Manisha 504
Kamal 505
Lakshmi 506

Here, Fee column is depending on Course column and it is


also a Super Key(no duplicates). This is also in BCNF
relation
Course Fee
(Non-Primary & Super Key) (Non-Primary Column)

BSc 5000
BCom 4000
BBA 7000
BA 6000
BL 8000

4 NF (Fourth Normal Form): Fourth Normal Form is a level of database


normalization that ensures there are no non-trivial multivalued
dependencies other than a candidate key. It builds upon the previous
normal forms (1NF, 2NF, 3NF, and BCNF) to further refine data integrity
and reduce redundancy.

For Example, consider a table of employees, projects, and skills

EmployeeID Project Skill


1 P1 Skill1
1 P1 Skill2
1 P2 Skill1
2 P3 Skill3
In this table, there's a multivalued dependency between EmployeeID and
Project on one side, and EmployeeID and Skill on the other. This means
that changes to projects for an employee do not affect the skills for that
employee, and vice versa.

A table is in 4NF if and only if it satisfies the following conditions:


1. It is in Boyce-Codd Normal Form (BCNF): This means that every
determinant in the table is a candidate key.
2. It has no non-trivial multivalued dependencies: A non-trivial MVD is
one where the dependent attributes are not a subset of the determinant.
Why 4NF is Important
• Eliminates redundancy: By breaking down tables with MVDs, you
reduce data duplication.
• Improves data integrity: Ensures data consistency and accuracy.
• Enhances query performance: Normalized tables often lead to faster
query execution.

Let's decompose the previous table into 4NF:


Table 1: Employee_Project
EmployeeID Project
1 P1
1 P1
1 P2
2 P3

Table 2: Employee_Skill
EmployeeID Skill
1 Skill1
1 Skill2
1 Skill1
2 Skill3
By separating the multivalued attributes into different tables, we achieve
4NF.

5NF (Fifth Normal Form): Fifth Normal Form, also known as


Projection-Join Normal Form (PJNF), is the highest level of database
normalization. It aims to eliminate redundancy in relational databases by
isolating semantically related multiple relationships.

Before diving into 5NF, it's crucial to understand join dependencies. A join
dependency exists when a table can be reconstructed by joining multiple
projections of itself. This indicates a potential redundancy or inconsistency
in the data.

A table is in 5NF if and only if:


• It is in 4NF.
• It does not contain any non-trivial join dependencies.
A non-trivial join dependency is a join dependency that is not implied by
a candidate key.
Student Course Professor
A C1 P1
A C2 P2
B C1 P1
B C2 P3
This table has a join dependency: {Student, Course} and {Student,
Professor}. This means the table can be reconstructed by joining two
smaller tables: Student-Course and Student-Professor.

To achieve 5NF, we decompose the table into:


• Student_Course: (Student, Course)
• Student_Professor: (Student, Professor)
Student Course
A C1
A C2
B C1
B C2

Student Professor
A P1
A P2
B P1
B P3
Fifth Normal Form is a theoretical concept and is rarely applied in practice.
While it can provide the ultimate level of normalization, the complexity
and overhead often outweigh the benefits. Most database designs achieve
sufficient data integrity and performance with lower normal forms like
3NF or BCNF.
================ =================

You might also like