ADBMSUnit2pptx 2023 07 31 11 36 38
ADBMSUnit2pptx 2023 07 31 11 36 38
COMPUTER
ENGINEERING
Unit 2
Advance
Normalization Database
Management
System
(09CE1502)
Redundancy means repeating data in database
Update
anomaly If updating do not occur at all places then database
will be in inconsistent state.
If the details of students in this table is deleted then
the details of college will also get deleted which
should not occur by common sense.
Delete
anomaly This anomaly happens when deletion of a data record
results in losing some unrelated information that was
stored as part of the record that was deleted from a
table.
Normalization is the process of organizing the data in
the database.
Normalizati
on Normalization is used to minimize the redundancy
from a relation or set of relations. It is also used to
eliminate the undesirable characteristics like
Insertion, Update and Deletion Anomalies.
Normalization divides the larger table into the smaller
table and links them using relationship.
Normalizati
on The normal form is used to reduce redundancy from
the database table.
1NF
2NF
Type of 3NF
First Normal
Form (1NF)
Before we learn about the second normal form, we
need to understand the following −
Second
Normal In the second normal form, all non-prime attributes
Form (2NF) are fully functional dependent on the prime attribute.
Second
Normal
Form (2NF)
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.
Teacher_detail Teacher_subject
Second
Normal
Form (2NF)
A relation will be in 3NF if it is in 2NF.
EMPLOYEE EMPLOYEE_ZIP
Third
Normal
Form (3NF)
BCNF is the advance version of 3NF. It is stricter than
3NF.
(BCNF) For BCNF, the table should be in 3NF, and for every
FD, LHS is super key.
Boyce Codd
normal form
(BCNF) Super keys
{STU_ID} NOT
POSSIBLE
{STU_ID, SUBJECT}
{SUBJECT, PROFESSOR_ID}NOT
POSSIBLE
Dependency
{student_id, subject} →
professor_id
Boyce Codd Professor_id → subject
normal form Non-prime Prime attribute
(BCNF) attribute
It violates the rule of BCNF.
Boyce Codd
normal form
(BCNF)
A set X of attributes in R is a superkey of R if and only
if X+ contains all attributes of R. In other words, X is a
superkey if and only if it determines all other
attributes.
ADB, ADC and ADE are candidate key for the relation
R, as (ADB)+ , (ADC)+ and (ADE)+ contain all attributes
of relation R.
R(ABCDE). FD(A → C, CD → B)
Since, A, D and E appear on LHS.
Candidate
(ADE)+ = (ACDE)
keys using (using A → C)
= (ABCDE) (using CD → B)
FDs :
Example 2 ADE is candidate key for the relation R, as (ADE)+
contain all attributes of relation R.
Steps to find the highest normal form of a
relation:
Highest
2. Divide all attributes into two categories: prime
Normal attributes and non-prime attributes.
form
3. Check for 1st normal form then 2nd and so on. If it
fails to satisfy nth normal form condition, highest
normal form will be n-1.
Is the relation in 1NF? Yes, always!
Highest
Is the relation in 2NF? Is there a composite CK? If
Normal not, 2NF is automatically achieved. Otherwise, check
form your LHS and RHS. If LHS is proper subset of
candidate key is determining non-prime attribute RHS
than it is not in 2NF.
Is the relation in 3NF? Does the relation have any
non-primes? If no, the relation is automatically in 3NF!
Otherwise: Is there a non-prime that determines
Highest (point to) another non-prime (resulting in a transitive
dependency because the last non-prime is
Normal determined indirectly)? If yes, 3NF does not pass (and
the relation is thus in 2NF).
form
Is the relation in BCNF? Are all the determinants
also candidate keys? If yes, BCNF pass.
Find the highest normal form of a
relation R(A,B,C,D,E) with FD set {A->D, B->A, BC-
>D, AC->BE}
Highest
The relation is not in 2nd Normal form because A->D is
Normal partial dependency (A which is subset of candidate
form: key AC is determining non-prime attribute D) and
2nd normal form does not allow partial dependency.
Example 1
So the highest normal form will be 1st Normal Form.
Find the highest normal form of a relation
R(A,B,C,D,E) with FD set as {BC->D, AC->BE, B->E}