Chapter 4 PDF
Chapter 4 PDF
✓ Database normalization is a series of steps followed to obtain a database design that allows for
✓ These steps reduce data redundancy and the risk of data becoming inconsistent.
✓ It is the process of identifying the logical associations between data items and designing a database that will
1. Insertion Anomalies
2. Deletion Anomalies
✓ Normalization may reduce system performance since data will be cross referenced from many tables.
Insertion anomalies
✓ Is a failure to place information about a new database entry into all the places in the database where
✓ Information about a new entry may need to be inserted into more than one place and, human fallibility.
Cont…
Deletion anomalies
✓ A "deletion anomaly" is a failure to remove information about an existing database entry when it is
time to remove that entry.
✓ information about that old entry may need to be deleted from more than one place, and, human
fallibility being what it is, some of the needed additional deletions may be missed.
Modification/Updating anomalies
✓ A modification of a database involves changing some value of the attribute of a table.
Cont…
Insertion Anomalies:
What if we have a new employee with a skill called Pascal? We can not decide weather Pascal is allowed as a
value for skill and we have no clue about the type of skill that Pascal should be categorized as. In addition, we are
required to record/insert values for the primary key column (i.e. we can’t insert value for skill column without
inserting values for EMPID column of employee).
Deletion Anomalies:
If employee with EMPID 16 is deleted then ever information about skill C++ and the type of skill is deleted from
the database. Then we will not have any information about C++ and its skill type.
Modification Anomalies:
What if the address for Helico is changed from Piazza to Mexico? We need to look for every occurrence of Helico and change
the value of SchoolAdd from Piazza to Mexico, which is prone to error.
Cont…
Functional Dependency (FD)
✓ Functional Dependencies (FDs) will decide whether a database design is correct or not.
✓ Depicts the relationship between attributes.
Example
Dinner Type of Wine
Meat Red
Fish White
Cheese Rose
Since the type of Wine served depends on the type of Dinner, we say Wine is functionally dependent on Dinner. And this
can be expressed as:
Dinner → Wine
Dinner Type of Wine Type of Fork
Meat Red Meat fork
Partial Dependency
If we have composite primary key and if an attribute which is not a member of all the primary key (i.e.
is dependent on some part of the primary key then that attribute is partially functionally dependent on
Let {A, B} is the Composite Primary Key and C is non key attribute.
Then if it should be {A, B}→C but B→C or A→C , Then C is partially functionally dependent on {A, B}.
Cont…
Full Dependency
If an attribute which is not a member of the primary key is not dependent on some part of the primary
key but the whole key (if we have composite primary key) then that attribute is fully functionally
Let {A, B} is the Composite Primary Key and C is non key attribute.
Then if {A, B}→C and B→C and A→C , Then C Fully functionally dependent on {A, B}.
Cont…
Transitive Dependency
In mathematics and logic, a transitive relationship is a relationship of the following form: "If A implies B, and if
also B implies C, then A implies C."
Example:
If Mr. X is a Human, and if every Human is an Animal, then Mr. X must be an Animal.
✓ Requires that all column values in a table are atomic (e.g., a number is an atomic value, while a list or
a set is not).
✓ It states that an attribute of a table cannot hold multiple values. It must hold only single-valued attribute.
✓ First normal form disallows the multi-valued attribute, composite attribute, and their combinations.
Example for First Normal Form (1NF): Consider the following unnormalized database table.
EmpID FirstName LastName Skill SkillType School SchoolAdd SkillLevel
✓ In the given table, non-prime attribute TEACHER_AGE is dependent on TEACHER_ID which is a proper subset
of a candidate key. That's why it violates the rule for 2NF.
✓ To convert the given table into 2NF, we decompose it into two tables:
Conti…
Conti…
This schema is in its 2NF since the primary key is a single attribute.
Let’s take StudID, Year and Dormitary and see the dependencies.
Student Dorm
StudID Stud F_Name Stud L_Name Dep’t Year Year Dormitary
125/97 Abebe Mekuria InfoSc 1 1 401
Advantages of Normalization
Disadvantages of Normalization
✓ You cannot start building the database before knowing what the user needs.
✓ The performance degrades when normalizing the relations to higher normal forms, i.e., 4NF, 5NF.
✓ Careless decomposition may lead to a bad database design, leading to serious problems.