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

LEC 10-Normalization

Uploaded by

Ahmad Mujtaba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

LEC 10-Normalization

Uploaded by

Ahmad Mujtaba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Normalization

Assessing the “goodness” of relations

Instructor: Farhan Sarwar


Relational
DBMS
Primary Key and Foreign
Key
What is
Normalization
Three Modification
Anomalies [1/3]
• Insert Anomaly
• We cannot record until we know information for the entire row.
• We cannot record a new sales office until we also know the sales person.
• Because in order to create the record, we need provide a primary key.
Three Modification
Anomalies [2/3]
• Update Anomaly
• The same information is recorded in multiple rows.
• If the office number changes, then
• There are multiple updates that need to be made.
• If these updates are not successfully completed across all rows, then an
inconsistency occurs.
Three Modification
Anomalies [3/3]
• Delete Anomaly
• Deletion of a row can cause more than one set of facts to be removed.
• If John Hunt is removed, then
• Deleting that row cause use to lose information about the New York office.
1N
F
Now in
1NF
2N
F
Functional
Dependency
• Functional dependency (FD) is a set of constraints
• Between two attributes in a relation, such that
• If two tuples have same values for attributes A1, A2,..., An, then
• Those two tuples must have to have same values for attributes B1, B2, ..., Bn.
• Functional dependency is represented by an arrow sign (→)
• X→Y, where X functionally determines Y
• The left-hand side determine the values on the right-hand side.
• Trivial − If a functional dependency (FD) X → Y holds, where Y is a subset of
X, then it is called a trivial FD. Trivial FDs always hold.
• Non-trivial − If an FD X → Y holds, where Y is not a subset of X, then it is
called a non-trivial FD.
Now in
2NF
3N
F
Now in
3NF
Another Example (Not-
Normalized)
Another Example
in 3NF
Your Task: Do it
Yourself
Your Task: Now
in 1NF
Is it in 3NF
Your Task: Now ?
in 2NF
Reasons for
Normalization
• There are three main reasons to normalize a database
• Minimize duplicate data
• Minimize or avoid data modification issues
• Simplify queries

• Consider the following data of Sales Staff:


Data Duplication and Modification
Anomalies

• Notice that for each SalesPerson we have listed both


• SalesOffice
• OfficeNumber
• This information is duplicated for each SalesPerson.
• Duplicated information presents two problems:
1. It increases storage and decrease performance.
2. It becomes more difficult to maintain data changes.
• Consider if we move the Chicago office to Evanston, IL.
• We need to update the entries for all the SalesPersons currently in Chicago.
• Also consider what would happen if John Hunt quits.
• If we remove his entry, then we lose the information for New York Office.

You might also like