Module 5 - Data NormalizationUpdated1
Module 5 - Data NormalizationUpdated1
2
Reflection: Why are you troubled
A life anchored on a deep relationship with Jesus is not
full of worries or troubles. If we truly believe in Jesus,
we won’t be troubled about death because we know
He has prepared a mansion for us in heaven. We will not
worry about what to eat or what to wear because we
are assured of His divine provision (Matthew 6:31). We
will then learn to live joyfully and at peace knowing that
our master is a good shepherd who will lead us unto the
right path to green pastures. Let us have faith in Him
and the Father.
https://peoplaid.com/2022/05/08/may-13-2022-gospel-reading-and-reflection-john-141-6/
3
Prayer
Module 5 –
Data Normalization
FINAL TERM – WEEK 14
Learning objectives
❑ Define terms.
❑ Give a concise definition of each of the following: first normal
form, second normal, and third normal form.
❑ Use normalization to decompose a relation with anomalies into
well-structured relations.
Data Normalization
Primarily a tool to validate and improve a logical
design so that it satisfies certain constraints that
avoid unnecessary duplication of data
The process of decomposing relations with
anomalies to produce smaller, well-structured
relations
8
Well-Structured Relations
A relation that contains minimal data redundancy and allows users to
insert, delete, and update rows without causing data inconsistencies
Goal is to avoid anomalies
Insertion Anomaly–adding new rows forces the user to create duplicate
data
Deletion Anomaly–deleting rows may cause a loss of data that would
be needed for other future rows
Modification Anomaly–changing data in a row forces changes to other
rows because of duplication
9
Goals of Normalization
1. Minimize data redundancy.
2. Simplify the enforcement of referential integrity constraints.
3. Make it easier to maintain data.
4. Provide a better design.
Example–Figure 4-2b
11
Anomalies in this Table
Insertion–can’t enter a new employee without having the employee take a class
(or at least empty fields of class information)
Deletion–if we remove employee 140, we lose information about the existence
of a Tax Acc class
Modification–giving a salary increase to employee 100 forces us to update
multiple records
12
Figure 4.22 Steps in normalization
13 13
Functional Dependencies and Keys
Functional Dependency: The value of one attribute (the determinant)
determines the value of another attribute
Candidate Key:
A unique identifier. One of the candidate keys will become the primary
key
E.g., perhaps there is both a credit card number and SS# in a
table…in this case, both are candidate keys.
Each non-key field is functionally dependent on every candidate key.
14
First Normal Form
No multivalued attributes
Every attribute value is atomic
Fig. 4-25 is not in 1st Normal Form
(multivalued attributes) ➔ it is not a
relation.
Fig. 4-26 is in 1st Normal form.
All relations are in 1st Normal Form.
15
Table with multivalued attributes, not in 1 st normal form
16 16
Table with no multivalued attributes and unique rows, in 1 st
normal form
17 17
Anomalies in this Table
Insertion–if new product is ordered for order 1007 of existing
customer, customer data must be re-entered, causing duplication
Deletion–if we delete the Dining Table from Order 1006, we lose
information concerning this item’s finish and price
Update–changing the price of product ID 4 requires update in
multiple records
Why do these anomalies exist?
Because there are multiple themes (entity types) in one
relation. This results in duplication and an unnecessary
dependency between the entities.
18
Second Normal Form
1NF PLUS every non-key attribute is fully functionally
dependent on the ENTIRE primary key
Every non-key attribute must be defined by the entire
key, not by only part of the key
No partial functional dependencies
19
Figure 4-27 Functional dependency diagram for INVOICE
21
Third Normal Form
2NF PLUS no transitive dependencies (functional dependencies on non-
primary-key attributes)
Note: This is called transitive because the primary key is a determinant for
another attribute, which in turn is a determinant for a third
Solution: Non-key determinants with transitive dependencies go into a new
table; non-key determinant becomes primary key in the new table and stays as
a foreign key in the old table
22
Figure 4-29 Removing partial dependencies
Getting it into
Third Normal
Form
23
24