0% found this document useful (0 votes)
137 views3 pages

2NF Example

The document discusses database normalization exercises on converting relations to 2NF. It provides two examples of relations that are not in 2NF due to partial dependencies between prime and non-prime attributes, and shows how to decompose them into multiple relations to satisfy 2NF. Students are given two additional relations as exercises to check if they are in 2NF, and decompose if needed. The goal is to practice identifying candidate keys and applying rules of 2NF to decompose relations as necessary.

Uploaded by

Dr. Neetu Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views3 pages

2NF Example

The document discusses database normalization exercises on converting relations to 2NF. It provides two examples of relations that are not in 2NF due to partial dependencies between prime and non-prime attributes, and shows how to decompose them into multiple relations to satisfy 2NF. Students are given two additional relations as exercises to check if they are in 2NF, and decompose if needed. The goal is to practice identifying candidate keys and applying rules of 2NF to decompose relations as necessary.

Uploaded by

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

National Institute of Electronics & Information Technology (NIELIT), Gorakhpur

राष्ट्रीय इलेक्ट्रॉनिकी एवं सूचिा प्रौद्योनगकी संस्थाि ,गोरखपुर

Course Name: A Level (1st Sem) Subject : Introduction to DBMS


Topic: DB Normalization – Exercise Practices on 2NF (Part 6) Date: 20-May-2020
------------------------------------------------------------------------------------------------------------------------------------------
Database Normalization – Exercise Practices on 2NF

Que 1: Suppose R(A B C D E) is relational schema and set of functional dependency :


FDs: A B
B E
C D
Find out the relation R is in 2NF or not? If not decompose it in 2NF.

Solution:
First find out the candidate key of the relation.
Since AC+ = A C D B E, (closure of AC contains all the attributes of R)
So AC is candidate key in above table.

Prime attribute - AC (because AC is the candidate key)


Non prime attribute - DBE (because DBE are not the part of the candidate key)

Now, the functional dependency A B and B E follow the rule of 2NF,


But functional dependency C D violates the rule of 2NF, because attribute C
which is prime attribute (part of the candidate key AC) is determining the non prime
attribute D. It is partial dependency and this type of partial dependency is not allowed in
2NF.
Therefore, to convert the relation R(A B C D) in 2NF, It is divided into three relations:
R1 (A B E) -- [ A B, B E]
R2 (C D) -- [ C D]
R3 ( A C) -- [ AC is candidate key ]
Now R1, R2 and R3 are following the rules of 2NF.
[Note: Although relation R1 and R2 covers all the FDs, but it is necessary to keep the
attributes of candidate key of original relation together to maintain the consistency and
integrity of data, that’s why attribute A C are kept in R3.]

Prepared By
National Institute of Electronics & Information Technology (NIELIT), Gorakhpur
राष्ट्रीय इलेक्ट्रॉनिकी एवं सूचिा प्रौद्योनगकी संस्थाि ,गोरखपुर

Que 2: Suppose R(A B C D E F G H I J) is relational schema and set of functional


dependency :
FDs: AB C
AD GH
BD EF
A I
H J
Find out the relation R is in 2NF or not? If not decompose it in 2NF.

Solution:
First find out the candidate key of the relation.
Since ABD+ = A B C D E F G H I J, (closure of ABD contains all the attributes of R)
So ABD is candidate key in above table.

Prime attributes – A B D (because ABD is the candidate key)


Non prime attributes – C E G H I J (because these are not the part of the candidate key)

Now, Only functional dependency H J follows the rule of 2NF,


But functional dependencies {AB C, AD GH, BD EF, A I} are violating
the rule of 2NF, because prime attributes are determining the non prime attributes.
It is the case of partial dependency and this type of partial dependency is not allowed in
2NF.
Therefore, to convert the relation R(A B C D) in 2NF, It is divided into five relations:
R1 ( A B C ) -- [ AB C]
R2 ( A D G H J ) -- [ AD GH, H J]

R3 ( B D E F ) -- [BD EF ]
R3 ( A I ) -- [A I]
R3 ( A B D) -- [ ABD is candidate key ]

Prepared By
National Institute of Electronics & Information Technology (NIELIT), Gorakhpur
राष्ट्रीय इलेक्ट्रॉनिकी एवं सूचिा प्रौद्योनगकी संस्थाि ,गोरखपुर

Now R1, R2, R3, R4 and R5 are following the rules of 2NF.

[Note: Although relation R1, R2, R3 and R4 covers all the FDs, but it is necessary to keep
the attributes of candidate key of original relation together to maintain the consistency and
integrity of data, that’s why attribute ABD are kept in R5.]

Exercise (Attempt it):


1. Suppose a relational schema R1 (A B C D E), and
FDs: AB C
D E
Check out the relation R1 is in 2NF or not? If not decompose it in 2NF.

2. Suppose a relational schema R2 (A B C D E), and


FDs: A C
B DE
Check out the relation R2 is in 2NF or not? If not decompose it in 2NF.

Prepared By

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy