Normalization (Brief Overview)
Functional Dependencies and Keys
1st Normal Form
2nd Normal Form
3rdNormal Form
3.5 Normal Form (Boyce Codd Normal Form-BCNF)
4thNormal Form
5thNormal Form(Project-Join Normal Form-PJNF)
Domain Key Normal Form (DKNF)
6thNormal Form
1. Institute of Southern Punjab,
Multan
Mr. Muhammad Nouman Farooq
BSC-H (Computer Science)
MS (Telecomm. and Networks)
Honors:
Magna Cumm Laude Honors Degree
Gold Medalist!
Blog Url: noumanfarooqatisp.wordpress.com
E-Mail: noman.iefr@hotmail.com
3. Lecture 6: Advanced Normalization
Normalization (Brief Overview)
Functional Dependencies and Keys
1st Normal Form
2nd Normal Form
3rd Normal Form
3.5 Normal Form (Boyce Codd Normal Form-BCNF)
4th Normal Form
5th Normal Form (Project-Join Normal Form-PJNF)
Domain Key Normal Form (DKNF)
6th Normal Form
Class Activity
3
5. Normalization (Brief Overview)
The main goal of Database Normalization is to restructure the
logical data model of a database to:
1. Eliminate Redundancy.
2. Organize Data Efficiently.
3. Reduce the possibility of Data Anomalies/Irregularities.
5
6. Continued…
Data anomalies are inconsistencies in the data stored in a database
as a result of an operation such as update, insertion, and deletion.
Such inconsistencies may arise when have a particular record stored
in multiple locations and not all of the copies are updated.
We can prevent such anomalies by implementing 7 different level of
normalization called Normal Forms (NF)
We’ll only look at the first Three.
6
7. Continued…
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 achieve 3rd NF we must have
2nd NF and in order to have 2nd NF we must have 1st NF.
7
8. Levels of Normalization
8
Levels of normalization based on the amount of redundancy
in the database.
Various levels of normalization are:
First Normal Form (1NF)
Second Normal Form (2NF)
Third Normal Form (3NF)
Boyce-Codd Normal Form (BCNF)
Fourth Normal Form (4NF)
Fifth Normal Form (5NF)
Domain Key Normal Form (DKNF)
Redundancy
NumberofTables
9.
10. Data Anomalies
1. Insertion Anomaly:
Cannot make a record of Jone’s address because he is not
taking any classes.
10
18. 1st Normal Form
The requirements to satisfy the 1st NF are:
1) Each table has a Primary Key: minimal set of attributes which
can uniquely identify a record
2) The values in each column of a table are Atomic (No multi-
value attributes allowed eg. stdCellNo; stdEmailAddress)
3) There are no repeating groups: two columns do not store
similar information in the same table.
18
22. 2nd Normal Form
The requirements to satisfy the 2nd NF:
All requirements for 1st NF must be met
Any partial functional dependencies have been removed (i.e., non-keys
are identified by the Whole Primary Key).
bookISBN --> bookTitle, bookFirstAuthorName, bookPublisher.
In the given above example; The title of a book, the name of the first
author, and the publisher are functionally dependent on the book's
International Standard Book Number (ISBN). In other words all listed
attributes are identified uniquely by the whole Primary Key which is
“bookISBN” and this relation/file/table/ENTITY is in 2nd Normal Form.
22
32. Continued…
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 Normal Forms (3-NF) are usually sufficient for small to
medium size applications.
32
33. 3.5 Normal Form (Boyce Codd Normal
Form-BCNF)
33
47. 5th Normal Form (Project-Join Normal
Form-PJNF)
47
48.
49.
50. In Natural Join operation; After Joining tables; Repeated Records in rows
are Eliminated
In Additive Lossy Join; spurious RECORD/TUPPLE/INSTANCE created
after Natural Joining on two or more than two tables (It can be called as
Information/record retrieve that was missing in original table)
In Non-Additive Lossless Join; We are not losing any Information and
not creating any SPURIOUS/FALSE RECORDS/INSTANCES/DATA in ROWS of
Relation/Table/File/Entity
51. Additive Lossy Join means EXTRA
RECORD/TUPPLE/INSTANCE created
after Natural Joining on two or more
than two tables
In Natural Join; After Joining
multiple tables; Repeated values
Eliminated as shown in figures
52. Projection of R1 Natural Join Projection of R2 Natural Join Projection of R3 ….. Natural Join Projection of Rn = R
R = R1 (R) ⋈ R2 (R) ⋈ …… ⋈ Rn(R)
53.
54. Conditions that Satisfies a Relation R is in 5-NF
A relation R is in 5-NF if and only if:
1) R must be in 4-NF.
2) If Join Dependency (JD) not exists.
a) If Non-Additive Lossless Join exists under one condition that is;
decomposition of main table/relation into smaller relations that must
eliminate redundant records with out losing original information and with
out creating false/spurious records.
b) If Additive Lossy Join exists than it will also be in 5-NF under one
condition that is; gaining meaningful information that was missing in
original relation (not called as spurious record in certain situation)
70. Class Activity: The Following Given ERD (Crow’s
Foot Style) is in which Normal Form?
70
71. Recommended Readings
Chapter 5 from:
Modern Database Management-8th Edition by Jeffrey
A. Hoffer, Mary B. Presscott & Fred R. McFadden
(Page No. 211-219)
Advanced Normal Forms from:
Modern Database Management-8th Edition by Jeffrey
A. Hoffer, Mary B. Presscott & Fred R. McFadden
(Page No. 605-610)
72. Recommended Readings
Chapter 14 from:
Database Systems-A Practical Approach to Design,
Implementation and Management by Thomas Connolly
and Carolyn Begg, 4th Edition (Page No. 481-485)
Chapter 4 from:
Database Systems-A Pragmatic Approach by Elvis C.
Foster, Shirpad V. Godbole (Page 72-79)
73. Summary of Lecture
73
Lecture 6➦
Normalization (Brief Overview)
Functional Dependencies and Keys
1st Normal Form
2nd Normal Form
3rd Normal Form
3.5 Normal Form (Boyce Codd Normal Form-BCNF)
4th Normal Form
5th Normal Form (Project-Join Normal Form-PJNF)
6th Normal Form
Class Activity