2. Name :
Moushumi Zaman Bonny
Designation
Senior Lecturer
Department
Department of Computer Science and
Engineering
Faculty
Faculty of Science and Information Technology
E-mail
bonny.cse@diu.edu.bd
5. Database Normalization
The main goal of Database
Normalization is to restructure the
logical data model of a database to:
Eliminate redundancy
Organize data efficiently
Reduce the potential for data
anomalies.
6. Brief History/Overview
Database Normalization was first proposed by Edgar F. Codd.
Codd defined the first three Normal Forms, which we’ll look into, of
the 7 known Normal Forms.
In order to do normalization we must know what the requirements
are for each of the three Normal Forms that we’ll go over.
One of the key requirements to remember is that Normal Forms are
progressive. That is, in order to have 3rd NF we must have 2nd NF
and in order to have 2nd NF we must have 1st NF.
7. Normal Form
Initially Codd (1972) presented three normal
forms (1NF, 2NF and 3NF) all based on
functional dependencies among the attributes
of a relation. Later Boyce and Codd proposed
another normal form called the Boyce-Codd
normal form (BCNF). The fourth and fifth
normal forms are based on multi-value and
join dependencies and were proposed later.
The primary objective of normalization is to
avoid anomalies.
8. 1st Normal Form
The Requirements
The requirements to satisfy the 1st NF:
Each table has a primary key: minimal set of
attributes which can uniquely identify a
record
The values in each column of a table are
atomic (No multi-value attributes allowed).
There are no repeating groups: two columns
do not store similar information in the same
table.
9. 1st Normal Form
Example
Un-normalized Students table:
Normalized Students table:
Student# AdvID AdvName AdvRoom Class1 Class2
123 123A James 555 102-8 104-9
124 123B Smith 467 209-0 102-8
Student# AdvID AdvName AdvRoom Class#
123 123A James 555 102-8
123 123A James 555 104-9
124 123B Smith 467 209-0
124 123B Smith 467 102-8
10. Definition
A functional dependency is defined as a
constraint between two sets of attributes
in a relation from a database.
Given a relation R, a set of attributes X in R
is said to functionally determine another
attribute Y, also in R, (written X → Y) if
and only if each X value is associated
with at most one Y value.
11.
12. Example
Employee
SSN Name JobType DeptName
557-78-6587 Lance Smith Accountant Salary
214-45-2398 Lance Smith Engineer Product
Note: Name is functionally dependent on SSN because an employee’s name
can be uniquely determined from their SSN. Name does not determine SSN,
because more than one employee can have the same name..
13. FULL AND PARTIAL FUNCTIONAL DEPENDENCY
• Grade is fully functionally dependent on the primary key (ID,
Course-ID) because both parts of the primary keys are needed to
determine Grade.
• On the other hand both Name and Phone attributes
are partially dependent on the primary key, because only a part
of the primary key namely ID is needed to determine them and
similarly Credit-Hours and Course-Name can be determined
using Course-ID .
ID Name Phone Course
ID
Course Name Credit
-Hours
Grad
e
14. • Closure of a set F of FDs is the set of all FDs logically implied by
F.
Example : Suppose we are given a relation scheme R=(A,B,C,G,H,I)
and the set of FDs as :
F={AB,CGH,CGI,BH }
Therefore, F + ={AH (By Transitivity), CGHI(By
Additivity or Union)}
INFERENCE RULES OF FDs
15. 2nd Normal Form
The Requirements
The requirements to satisfy the 2nd NF:
All requirements for 1st NF must be met.
Redundant data across multiple rows of
a table must be moved to a separate
table.
○ The resulting tables must be related to each
other by use of foreign key.
16.
17. 2nd Normal Form
ExampleStudents table
Registration table
Student AdvID AdvName AdvRoom
123 123A James 555
124 123B Smith 467
Student Class
123 102-8
123 104-9
124 209-0
124 102-8
18. 3rd Normal Form
The Requirements
The requirements to satisfy the 3rd NF:
All requirements for 2nd NF must be met.
Eliminate fields that do not depend on
the primary key;
○ That is, any field that is dependent not only on
the primary key but also on another field must
be moved to another table.
19. 3rd Normal Form
Example
Students table:
Student table: Advisor table:
Student# AdvID AdvName AdvRoom
123 123A James 555
124 123B Smith 467
Student# AdvID
123 123A
124 123B
AdvID AdvName AdvRoom
123A James 555
123B Smith 467
20. 3rd Normal Form
Example Cont.Students table:
Registration table: Advisor table:
Student# Class#
123 102-8
123 104-9
124 209-0
124 102-8
AdvID AdvName AdvRoom
123A James 555
123B Smith 467
Student# AdvID
123 123A
124 123B
21. Conclusion
We have seen how Database
Normalization can decrease redundancy,
increase efficiency and reduce anomalies
by implementing three of seven different
levels of normalization called Normal
Forms. The first three NF’s are usually
sufficient for most small to medium size
applications.