0% found this document useful (0 votes)
4 views

Module 5 - Data NormalizationUpdated1

Uploaded by

razyfreel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Module 5 - Data NormalizationUpdated1

Uploaded by

razyfreel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

1

Gospel: John 14:1-6


1 Jesus said to his disciples: Let not your heart be troubled. You believe in
God, believe also in me.
2 In my Father’s house there are many mansions. If not, I would have told
you: because I am going to prepare a place for you.
3 And if I shall go, and prepare a place for you, I will come again, and will take
you to myself; that where I am, you also may be.
4 And where I go you know, and the way you know.
5 Thomas said to him: Lord, we know not where you go; and how can we
know the way?
6 Jesus said to him: I am the way, and the truth, and the life. No man comes
to the Father but by me.

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

General rule of thumb: A table should not pertain to


more than one entity type.

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

Answer–Yes: Unique rows and no


Question–Is this a relation? multivalued attributes
Question–What’s the primary key? Answer–Composite: EmpID, CourseTitle

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

Why do these anomalies exist?


Because there are two themes (entity types) in this one
relation. This results in data duplication and an unnecessary
dependency between the entities.

12
Figure 4.22 Steps in normalization

3rd normal form is


generally considered
sufficient

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

Note: This is NOT a relation.

16 16
Table with no multivalued attributes and unique rows, in 1 st
normal form

Note: This is a relation, but not a well-structured one.

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

OrderID ➔ OrderDate, CustomerID, CustomerName, CustomerAddress


CustomerID ➔ CustomerName, CustomerAddress
ProductID ➔ ProductDescription, ProductFinish, ProductStandardPrice
OrderID, ProductID ➔ OrderQuantity

Therefore, NOT in 2nd Normal Form


20
Figure 4-28 Removing partial dependencies

Getting it into Second


Normal Form

Partial dependencies are removed, but there are still transitive


dependencies

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

Transitive dependencies are removed.

23
24

You might also like