Normalization(V2)
Normalization(V2)
Mapping &
Normalizatio
n Third Learning
Outcome
Agenda
• Why Normalization
• Type of Anomalies
• Functional Dependency
• What is Normalization
• What role it plays in database
design
• 1st. Normal Form
• 2nd. Normal Form
• 3rd. Normal Form
• BC Normal Form (BCNF)
Why Normalization
To produce well-structured relations by eliminating anomalies
• Make the database more efficient
• Prevent the same data from being stored in more than one place (called an “insert
anomaly”)
• Prevent updates being made to some data but not others (called an “update anomaly”)
• Prevent data not being deleted when it is supposed to be, or from data being lost when
For example, if we wanted to add a new student but did not know their
course name.
For example, let’s say the class Biology 1 was changed to “Intro to Biology”. We would
have to query all of the columns that could have this Class field and rename each one
that was found.
There’s a risk that we miss out on a value, which would cause issues.
Delete anomaly
A delete anomaly occurs when we want to delete data from the table, but we end up
deleting more than what we intended.
For example, let’s say Susan Johnson quits and her record needs to be deleted from
the system. We could delete her row:
But, if we delete
this row, we lose
the record of the
Biology 2 class,
because it’s not
stored anywhere
else. The same can
be said for the
Medicine course.
Type of Anomalies
Let's Watc
h if the schema is not
normalized, it will
definitely contain
anomalies
Functional Dependency
As we said before, normalization solves anomalies ,,
but what is Normalization ?
Normalization is based on
Functional Dependency: The value of one attribute determines the value of another
attribute
There are three main normal forms that you should consider
(Actually, there are six normal forms in total, but the first three
are the most common).
Form
To be in First Normal Form (1NF):
Form
To be in Second Normal Form (2NF):
To Form
be in third Normal Form (3NF):
• All attributes that are not dependent upon the primary key must
be eliminated. In other words, there should be no transitive
dependencies.
• remove columns that are not dependent upon the primary key.
Form
To be in Forth Normal Form (4NF):
Invoice
• Invoice No. pk
Inv-Products
• Invoice No. FK
• Date
• Code (comp PK)
• Customer ID
• Customer Name
• Name
• Customer Phones
• Unit Price
• Cashier ID
• Qty
• Cashier Name
• Name
Transform to(2NF) Remove partial
dependency
Customer Cashier
• Customer ID pk
• Cashier ID pk Products
• customer name
• cashier name
• customer phones (pass)
• Code pk
• Name
• Unit Price
Transform to(4NF)
Remove multi-valued
attributes
Invoice (pass)
• Invoice No. pk Inv-Products (pass)
• Date Products (pass)
• Invoice No. FK
• Customer ID • Code pk
• Code (comp PK)
• Cashier ID • Name
• Qty
• Unit Price
Cashier (pass)
• Cashier ID pk
Customer
• cashier name Customer/phones
• Customer ID pk • Customer ID fk
• customer name • customer phone
(comp pk)
Normalization and Database
Design