DB Week 2 Lecture 2
DB Week 2 Lecture 2
Normalization
Conducted by
Hasan Muhammad Kafi
Lecturer, Dept. of CSE
Bangladesh Army University of Science and Technology (BAUST)
Functional Dependency
• A functional dependency (FD) is a relationship between two attributes,
typically between the PK and other non-key attributes within a table.
• The left side of the above FD diagram is called the determinant, and
the right side is the dependent.
Examples
• Example 1: SIN determines Name, Address and Birthdate. Given SIN,
we can determine any of the other attributes within the table.
SIN Name, Address, Birthdate
Also
Student_Id Student_Id
Student_Name Student_Name
Non-Trivial Functional Dependency
• If a functional dependency XY holds true where Y is not a subset of
X then this dependency is called non trivial Functional dependency.
emp_id emp_name
emp_id emp_address
Normalization
• Database Normalization is a technique of organizing the data in
the database.
• There are three types of anomalies that occur when the database
is not normalized:
Insertion anomaly.
Update anomaly.
Deletion anomaly.
Insertion Anomaly
• There are facts we cannot record until we know information for
the entire row.
Example: we cannot record a new sales office until we also know the
sales person.
Update Anomaly
• The same information is recorded in multiple rows.
For instance, 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.
Deletion Anomaly
• Deletion of a row can cause more than one set of facts to be
removed.
For instance, if John Hunt retires, then deleting that row cause use to
lose information about the New York office.