Normalization in SQL
Normalization in SQL
SQL
Normalization
Decompose larger, complex table into simpler and smaller ones
Moves from Lower Normal forms to higher normal forms
Normalization
Higher
1NF 2NF 3NF
(BCNF,4NF,5NF)
Need for Normalization
In order to produce good database design
To ensure all database operation to be efficiently performed
Avoid any expensive DBMS operations
Avoid Unnecessary replication of information
Need for Normalization
Raw Sample Database
P(Student#,Cour
Q(Marks)
se#)
Type of Functional Dependency
Transitive Dependency
Partial Functional Dependency
Attribute Q is partially dependent in attribute p, if and only if it is depenedent on the subset of
attribute P
Report (Student#,Course#,StudentName,CourseName,Marks,Grade)
Student #
Marks
Course #
Course # CourseName
Transitive Dependency
X,Y,Z are the 3 Attributes
X Y Y Z
X Z
Date of
Student# Name DOB Course# CourseName Duration Prerequisite Exam Marks Grade
101Jack 11-04-1975M1 Advance Maths 17Basic Maths 03-11-2019 82A
102Rock 10-04-1974P4 Advance Physics 12Basic Physics 22-12-2018 78B
103Jen 10-09-1975B3 Advance Biology 10Basic Biology 03-11-2019 88A
104Smith 15-03-1974H6 Advance History 19Basic History 22-11-2018 68B
105Ashok 16-12-1976C3 Advance Chemistry 13Basic Chemistry 23-11-2019 52C
2NF
A relation is said to be in 2NF if and only if:
◦ It is in 1st NF
◦ No partial dependency exists between key and non key attributes