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

NORMALIZATION

The document discusses normalization and different normal forms including 1NF, 2NF, 3NF, BCNF, and examples of relations and their functional dependencies. It provides definitions of each normal form and checks sample relations to determine if they satisfy the normal form requirements. For example, it checks a relation with attributes Stud_ID, Course_ID, Course_Fee and determines it is not in 2NF since Course_Fee has a partial dependency on the candidate key.
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)
30 views

NORMALIZATION

The document discusses normalization and different normal forms including 1NF, 2NF, 3NF, BCNF, and examples of relations and their functional dependencies. It provides definitions of each normal form and checks sample relations to determine if they satisfy the normal form requirements. For example, it checks a relation with attributes Stud_ID, Course_ID, Course_Fee and determines it is not in 2NF since Course_Fee has a partial dependency on the candidate key.
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/ 42

NORMALIZATION

Q28. Requirement of Normalization?


Ans. ?
Q28. Requirement of Normalization?
Ans. To reduce or eliminate data redundancy (having the same data
but at different places)

Q29. Requirement to eliminate data redundancy?


Ans. ?
Q28. Requirement of Normalization?
Ans. To reduce or eliminate data redundancy (having the same data
but at different places)

Q29. Requirement to eliminate data redundancy?


Ans. Data redundancy unnecessarily increases the size of the database
as the same data is repeated in many places. Inconsistency problems
also arise during insert, delete and update operations.
Types of Normal Forms
• 1NF (First Normal Form)
• 2NF (Second Normal Form)
• 3NF (Third Normal Form)
• BCNF (Boy-Codd Normal Form)
• 4NF (Fourth Normal Form)
• 5NF (Fifth Normal Form)
First Normal Form
• A relation is in first normal form if every attribute in that relation is singled
valued attribute.
Second Normal Form
To be in second normal form, a relation must
• be in first normal form and
• not contain any partial dependency.

Partial Dependency – If the proper subset of candidate key determines


non-prime attribute, it is called partial dependency.
Second Normal Form
Stud_ID Course_ID Course Fee

1 C1 1000
2 C2 1500
1 C4 2000
4 C3 1000
4 C1 1000
2 C5 2000

Functional Dependencies based on the above table ?


Second Normal Form
Stud_ID Course_ID Course_Fee

1 C1 1000
2 C2 1500
1 C4 2000
4 C3 1000
4 C1 1000
2 C5 2000

Functional Dependencies based on the above table


Course_ID -> Course_Fee
Stud_ID Course_ID -> Course_Fee
Second Normal Form
1. Course_ID -> Course_Fee
2. Stud_ID Course_ID -> Course_Fee

Candidate Key ?
Second Normal Form
1. Course_ID -> Course_Fee
2. Stud_ID Course_ID -> Course_Fee

Candidate Key – {Stud_ID, Course_ID}

COURSE_FEE is dependent on a proper subset of the candidate key,


which is a partial dependency and so this relation is not in 2NF.
Second Normal Form
1. Course_ID -> Course_Fee
2. Stud_ID Course_ID -> Course_Fee

Candidate Key – {Stud_ID, Course_ID}

COURSE_FEE is dependent on a proper subset of the candidate key, which is a partial


dependency and so this relation is not in 2NF.

To convert the above relation to 2NF,


we need to split the table into two tables such as :
Table 1: STUD_ID, COURSE_ID
Table 2: COURSE_ID, COURSE_FEE
Second Normal Form
Q30. Check whether the relation R(A, B, C, D) with the following
functional dependencies-
AB -> C, BC -> D
Is in 2NF or not.
Ans. ?
Second Normal Form
Q30. Check whether the relation R(A, B, C, D) with the following
functional dependencies-
AB -> C, BC -> D
Is in 2NF or not.
Ans. Yes, the given relation is in 2NF.
Explanation - AB is the only candidate key and there is no partial
dependency.
Third Normal Form
A relation is in third normal form, if
• It is in 2NF and
• There is no transitive dependency for non-prime attributes.
Transitive dependency – If A->B and B->C are two FDs then A->C is called transitive
dependency.

OR

A relation is in 3NF if at least one of the following condition holds in every non-trivial
function dependency X –> Y
1. X is a super key.
2. Y is a prime attribute (each element of Y is part of some candidate key).
Third Normal Form
Stud_ID STUD_NAME STUD_STATE STUD_COUNTRY STUD_AGE
1 RAM UP INDIA 20
2 RAM MP INDIA 19
3 SHYAM MP INDIA 21

Q31. In above relation STUDENT, FD set:


{STUD_NO -> STUD_NAME, STUD_NO -> STUD_STATE, STUD_STATE ->
STUD_COUNTRY, STUD_NO -> STUD_AGE}

Ans. ?
Third Normal Form
In above relation STUDENT, FD set:
{STUD_ID -> STUD_NAME, STUD_ID -> STUD_STATE, STUD_STATE ->
STUD_COUNTRY, STUD_ID -> STUD_AGE}

Candidate Key: { STUD_ID}


Q31. Check, whether the given relation is in 3NF or Not?
Ans. Steps to check
1. Is relation in 2NF – Yes, there is no partial dependency exist.
2. Is transitive dependency for non-prime attributes in the relation – Yes,
STUD_COUNTRY is non prime attribute and transitively dependent on
STUD_ID.
Hence, the given relation is not in 3NF.
Third Normal Form
To convert it in third normal form, we will decompose the relation
STUDENT (STUD_ID, STUD_NAME, STUD_STATE, STUD_COUNTRY,
STUD_AGE) as:

STUDENT (STUD_NO, STUD_NAME, STUD_STATE, STUD_AGE)

STATE_COUNTRY (STATE, COUNTRY)


Third Normal Form
Q32. Consider relation R(A, B, C, D, E)
A -> BC,
CD -> E,
B -> D,
E -> A, Is R in 3NF ?
Ans. ?
Third Normal Form
Q32. Consider relation R(A, B, C, D, E)
A -> BC,
CD -> E,
B -> D,
E -> A, Is R in 3NF ?
Ans. Yes
Boyce-Codd Normal Form (BCNF)

BCNF is the advance version of 3NF. It is stricter than 3NF. A relation is


in BCNF if
• The relation is in 3NF and
• for every FD, LHS is super key.
Boyce-Codd Normal Form (BCNF)

EMP_ID EMP_COU EMP_DEPT DEPT_TYP EMP_DEPT


NTRY E _NO
264 India Designing D394 283
264 India Testing D394 300
364 UK Stores D283 232
364 UK Developing D283 549

In the above table Functional dependencies are as follows:


1. EMP_ID  →  EMP_COUNTRY  
2. EMP_DEPT  →   {DEPT_TYPE, EMP_DEPT_NO}  
Q33. Is above relation table in BCNF?
Ans. ?
Boyce-Codd Normal Form (BCNF)

1. EMP_ID  →  EMP_COUNTRY
2. EMP_DEPT  →   {DEPT_TYPE, EMP_DEPT_NO}  

Q33. Is above relation table in BCNF?


Ans. No, the relation is not in BCNF.
Explanation
Candidate key: {EMP-ID, EMP-DEPT}
The table is not in BCNF because neither EMP_DEPT nor EMP_ID
alone are super key.
Steps to find the highest normal form of
relation
1. Find all possible candidate keys of the relation.

2. Divide all attributes into two categories: prime attributes and non-
prime attributes.

3. Check for 1st normal form then 2nd and so on. If it fails to satisfy the
nth normal form condition, the highest normal form will be n-1.
EMP_ID EMP_COU EMP_DEPT DEPT_TYP EMP_DEPT
NTRY E _NO
264 India Designing D394 283
264 India Testing D394 300
364 UK Stores D283 232
364 UK Developing D283 549

In the above table Functional dependencies are as follows:


1. EMP_ID  →  EMP_COUNTRY  
2. EMP_DEPT  →   {DEPT_TYPE, EMP_DEPT_NO}  

Q34. Find the highest normal form of this relation?


Ans. ?
In the above table Functional dependencies are as follows:
1. EMP_ID  →  EMP_COUNTRY  
2. EMP_DEPT  →   {DEPT_TYPE, EMP_DEPT_NO}  

Q34. Find the highest normal form of this relation?


Ans.
Step 1. Possible Candidate Keys – {EMP_ID, EMP_DEPT}
Step 2. Prime attributes – EMP_ID, EMP_DEPT
Non Prime attributes – EMP_COUNTRY, DEPT_TYPE, EMP_DEPT_NO
Step 3. Is relation in 1NF - ?
In the above table Functional dependencies are as follows:
1. EMP_ID  →  EMP_COUNTRY  
2. EMP_DEPT  →   {DEPT_TYPE, EMP_DEPT_NO}  

Q34. Find the highest normal form of this relation?


Ans.
Step 1. Possible Candidate Keys – {EMP_ID, EMP_DEPT}

Step 2. Prime attributes – EMP_ID, EMP_DEPT


Non Prime attributes – EMP_COUNTRY, DEPT_TYPE, EMP_DEPT_NO

Step 3. Is relation in 1NF – Yes


Is relation in 2NF – ?
In the above table Functional dependencies are as follows:
1. EMP_ID  →  EMP_COUNTRY  
2. EMP_DEPT  →   {DEPT_TYPE, EMP_DEPT_NO}  

Q34. Find the highest normal form of this relation?


Ans.
Step 1. Possible Candidate Keys – {EMP_ID, EMP_DEPT}

Step 2. Prime attributes – EMP_ID, EMP_DEPT


Non Prime attributes – EMP_COUNTRY, DEPT_TYPE, EMP_DEPT_NO

Step 3. Is relation in 1NF – Yes


Is relation in 2NF – No, since both FDs are partial functional dependencies.
Hence, the highest normal form is 1NF.
Q35. 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}.
Ans. Step 1. Possible Candidate Keys – ?

Step 2. Prime attributes – ?


Non-prime attributes – ?

Step 3. BCNF – ?
3NF – ?
2NF – ?
1NF – ?
Q35. 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}.
Ans.
Step 1. Possible Candidate Keys – {AC} and {BC}

Step 2. Prime attributes – {A, B, C}


Non-prime attributes – {D,E}

Step 3.
BCNF – No
3NF – No
2NF – No
1NF – Yes

So, the highest normal form is 1NF.


Q36. Find the highest normal form of a relation R(A,B,C,D,E) with FD
set {B->A, A->C, BC->D, AC->BE}
Ans. ?
Step 1. Possible Candidate Keys – ?

Step 2. Prime attributes – ?


Non-prime attributes – ?

Step 3. 1NF – ?
2NF – ?
3NF – ?
BCNF – ?
Q36. Find the highest normal form of a relation R(A,B,C,D,E) with FD set
{B->A, A->C, BC->D, AC->BE}
Ans.
Step 1. Possible Candidate Keys – {A} and {B}

Step 2. Prime attributes – {A, B}


Non-prime attributes – {C, D, E}

Step 3. 1NF – Yes


2NF – Yes. As no FD is partial FD.
3NF – Yes. As there is no transitive dependency for non-prime attributes.
BCNF – Yes, As all LHS of all FD’s are super keys.

So, highest normal form is BCNF.


Q37. For the relation R(ABCDEFGH) with FD's= {CH->G, A->BC, B->CHF,
E->A, F->EG such that F+ is exactly the set of FDs that hold for R.}
Consider the FDs given in above question. The relation R is

A. in 1NF, but not in 2NF.


B. in 2NF, but not in 3NF.
C. in 3NF, but not in BCNF.
D. in BCNF
Q37. For the relation R(ABCDEFGH) with FD's= {CH->G, A->BC, B->CHF,
E->A, F->EG such that F+ is exactly the set of FDs that hold for R.}
Consider the FDs given in above question. The relation R is

A. in 1NF, but not in 2NF.


B. in 2NF, but not in 3NF.
C. in 3NF, but not in BCNF.
D. in BCNF
Q38. Consider the following relational schemes for a library database: Book (Title,
Author, Catalog_no, Publisher, Year, Price), Collection (Title, Author, Catalog_no) with
in the following functional dependencies:
I. Title Author --> Catalog_no
II. Catalog_no --> Title, Author, Publisher, Year
III. Publisher Title Year --> Price
Assume {Author, Title} is the key for both schemes. Which of the following
statements is true?

A. Both Book and Collection are in BCNF


B. Both Book and Collection are in 3NF only
C. Book is in 2NF and Collection is in 3NF
D. Both Book and Collection are in 2NF only
Q38. Consider the following relational schemes for a library database: Book (Title,
Author, Catalog_no, Publisher, Year, Price), Collection (Title, Author, Catalog_no) with
in the following functional dependencies:
I. Title Author --> Catalog_no
II. Catalog_no --> Title, Author, Publisher, Year
III. Publisher Title Year --> Price
Assume {Author, Title} is the key for both schemes. Which of the following
statements is true?

A. Both Book and Collection are in BCNF


B. Both Book and Collection are in 3NF only
C. Book is in 2NF and Collection is in 3NF
D. Both Book and Collection are in 2NF only
Q39. The relation scheme Student_Performance (name, courseNo, rollNo, grade) has
the following functional dependencies:
name, courseNo → grade
rollNo, courseNo → grade
name → rollNo
rollNo → name
The highest normal form of this relation scheme is

A. 2NF
B. 3NF
C. BCNF
D. 4NF
Q39. The relation scheme Student_Performance (name, courseNo, rollNo, grade) has
the following functional dependencies:
name, courseNo → grade
rollNo, courseNo → grade
name → rollNo
rollNo → name
The highest normal form of this relation scheme is

A. 2NF
B. 3NF
C. BCNF
D. 4NF
Q40. Every time attribute A appears, it is matched with the same value
of attribute B, but not the same value of attribute C. Therefore, it is true
that:

a) A -> B
b) A -> C
c) A -> (B,C)
Q40. Every time attribute A appears, it is matched with the same value
of attribute B, but not the same value of attribute C. Therefore, it is true
that:

a) A -> B
b) A -> C
c) A -> (B,C)
Q41. Let R(A, B, C, D, E, F, G) be a relational schema in which the
following functional dependencies are known to hold: AB ->CD, DE ->F,
C ->E, F ->C and B ->G
The relational schema is

a) not in 2 NF
b) in 2NF but not in 3NF
c) in 3NF
Q41. Let R(A, B, C, D, E, F, G) be a relational schema in which the
following functional dependencies are known to hold: AB ->CD, DE ->F,
C ->E, F ->C and B ->G
The relational schema is

a) not in 2 NF
b) in 2NF but not in 3NF
c) in 3NF

You might also like