You are on page 1of 26

DATABASE MANAGEMENT SYSTEMS

Normalization

Solutions

Linked Question:

1. Common Data:

A relation R is given as

Eid Ename PhoneNo


9980734567
1 Rakesh
9524312988
8798214587
2 Ram
08632374568
9887653540
3 Ravi
040225678

(i) What is the highest normal form satisfying above relation?

(a) 1NF (b) 2NF

(c) 3NF (d) None

(ii) If the above relation is converted into 1NF, what will be the no. of rows in the resulting
relation? (Assume we can create only one relation)

(a) 9 (b) 7

(c) 8 (d) 6

Solution: (i)  (d), (ii)  (d)

Explanation:

(i) As the relation contains multivalued attribute phoneNo, the relation is in un-normalized form.

(ii) First Normal form does not allow multivalued attributes. So, the given table should be
converted as

1
Eid Ename PhoneNo
1 Rakesh 9980734567
1 Rakesh 9524312988
2 Ram 8798214587
2 Ram 08632374568
3 Ravi 988765340
3 Ravi 040225678

So, the number of tuples after converting the given table to 1NF is 6. So, answer is (d) 6.

2. Given relation R(ABCDE) with FD set 𝐹 = {𝐴𝐵 → 𝐶𝐷𝐸, 𝐴 → 𝐶, 𝐸 → 𝐴𝐵}. What is the
normal form of the above relation?

(a) 1NF (b) 2NF

(c) 3NF (d) BCNF

Solution: Option (a)

Explanation:

Given:

𝑅(𝐴𝐵𝐶𝐷𝐸) and FD’s : 𝐴𝐵 → 𝐶𝐷𝐸 ------>①


𝐴→𝐶 ------>②
𝐸 → 𝐴𝐵 ------->③

First we have to find candidate key:

First try to find closure for all single attributes like 𝐴+ , 𝐵 + , 𝐶 + , 𝐷 + , 𝐸 +


Only 𝐸 + = 𝐸𝐴𝐵𝐶𝐷𝐸.

∴ 𝐸 𝑖𝑠 𝑐𝑎𝑛𝑑𝑖𝑑𝑎𝑡𝑒 𝑘𝑒𝑦.

Then try for all combinations of two attributes like (AB), (BC), (CD), (AD), (BD)… (Need not
try the combination with E as E is candidate key, any combination with E will become
superkey).

Only (𝐴𝐵)+ = 𝐴𝐵𝐶𝐷𝐸; Therefore AB is candidate key.

Similarly, try for all combinations of three attributes like (𝐵𝐶𝐷), (𝐴𝐶𝐷) (need not try the
combination with E and AB as E and AB are already candidate keys and any combination with
them will become superkey), but no combination attributes closure determines all attributes. So

2
they are no candidate key with three attributes. We cannot form any four attribute combination
without using AB and E, so no need to try for that combination. Therefore candidate keys for
given relation R(ABCDE) are A, BE. This means A, B, E are prime attributes. C, D are non-
prime attributes.

We know that a relation R is said to be in 2NF, only if they are no partial dependencies in it.
Partial dependency is nothing but the part of a key determining non-prime attribute. So, we
check whether any partial dependencies are present in given relation R.

FD① is not partial dependency as left side of FD is key.

FD② is partial dependency as left side of FD i.e. A is part of key (AB) and is determining non-
prime attribute C. 𝐴 (𝑝𝑎𝑟𝑡 𝑜𝑓 𝑡ℎ𝑒 𝑘𝑒𝑦) → 𝐵(𝑛𝑜𝑛 𝑝𝑟𝑖𝑚𝑒 𝑎𝑡𝑡𝑟𝑖𝑏𝑢𝑡𝑒).

So, FD② violates 2NF.

Given relation is in 1NF.

3. Given relation R (ABCD) with BD as primary key. Which functional dependency violates
3NF?

(a) 𝐴 → 𝐶 (b) 𝐵 → 𝐷

(c) 𝐵𝐷 → 𝐴 (d) 𝐵𝐷 → 𝐶

Solution: Option (a)

Explanation:

Given BD is primary key. So B, D are prime attributes. A, C are non-prime attributes.

We have to check which functional dependency in R violates 3NF.

Formal definition of 3NF states that for every non-trivial FD 𝑋 → 𝑌 𝑖𝑛 𝑅, either X is a Superkey
in R or Y is a prime attribute.

Check for Option (a):


𝐴→𝐶
In this FD, A is not superkey and C is not prime attribute. So, 𝐴 → 𝐶 violates 3NF.

Check for Option (b):


𝐵→𝐷
In this FD, even though B is not superkey, D is prime attribute. So, 𝐵 → 𝐷 does not violate 3NF.

Check for Option (c):


3
𝐵𝐷 → 𝐴
In this FD, left side of FD i.e. BD is superkey. So, 𝐵𝐷 → 𝐴 does not violate 3NF.

Check for Option (d):


𝐵𝐷 → 𝐶
Here left side of FD i.e. BD is superkey. So, 𝐵𝐷 → 𝐶 does not violate 3NF.

Note:- Every Candidate key is superkey. Therefore, BD is superkey.

4. The highest normal form of the relation R(A, B, C, D) if the following FD’s are satisfied by
relation:

𝐹: {𝐴𝐵 → 𝐷, 𝐴𝐶 → 𝐵𝐷, 𝐵 → 𝐶}

(a) BCNF (b) 3NF

(c) 2NF (d) 1NF

Solution: Option (b)

Explanation:

Find out Candidate key:

A is not there in right hand side of any FD, So A is necessary in every candidate key, so check
for, (𝐴)+ , (𝐴)+ = 𝐴. As (𝐴)+ does not determine all attributes, Therefore A is not sufficient.
∴ 𝐴 𝑖𝑠 𝑛𝑜𝑡 𝐶𝑎𝑛𝑑𝑖𝑑𝑎𝑡𝑒 𝑘𝑒𝑦, but A should be definitely present in every candidate key.

Try for combination of 2 attributes including A like (𝐴𝐵)+ , (𝐴𝐶)+ , (𝐴𝐷)+ .


Only AB, AC are candidate keys since (𝐴𝐵)+ = 𝐴𝐵𝐶𝐷 and (𝐴𝐶)+ = 𝐴𝐶𝐵𝐷.

Try for combination of 3 attributes including A but excluding AB, AC. There is no such
combination. So, need not to try for 3 attributes combination.
∴ Candidate key for given relation R are AB, AC.
∴ A, B, C are prime attributes. D is non-prime attribute.

Given FD’s:

𝐴𝐵 → 𝐷 ------>①
𝐴𝐶 → 𝐵𝐷 ------>②
𝐵→𝐶 ------>③

Check whether relation R violates 2NF:

4
A relation R violates 2NF if and only if any partial dependencies are present in R. Partial
dependency means part of the key, determining non-prime attribute.

FD① is not partial dependency since left side of FD i.e AB is key.

FD②is not partial dependency since left side of FD i.e AC is key.

FD③is not partial dependency since left hand side of FD i.e B is part of key but C which is on
right hand side of FD is a prime attribute. So ③ is not partial dependency.
∴ Relation R satisfies 2NF.

Check whether relation R violates 3NF:


Formal definition of 3NF states that for every non-trivial FD 𝑋 → 𝑌 in R, either X is a Superkey
in R or Y is a prime attribute.

In FD①, left side of FD i.e. AB is superkey.


∴FD① satisfies 3NF.

In FD②, left hand side of FD i.e. AC is superkey.


∴FD② satisfies 3NF.

In FD③, left hand side of FD i.e. B is not superkey, but right hand side of FD i.e. C is prime
attribute.
∴ 𝐹𝐷③ satisfies 3NF.
∴ Given relation R satisfies 3NF.

Check whether relation R violates BCNF:


A relation R is said to be in BCNF, if for every non-trivial FD 𝑋 → 𝑌in R, X is a Superkey in R.

FD① satisfies BCNF, since left side of FD i.e. AB is superkey

FD② satisfies BCNF, since left side of FD i.e. AC is Superkey

FD③ does not satisfies BCNF, since left side of FD i.e. B is not Superkey

∴ Relation R does not satisfy BCNF.


∴ Highest normal form of given relation R(ABCD) is 3NF.

5. A prime attribute of a relation schema R is an attribute that appears

(a) In all candidate keys of R

(b) In some candidate key of R

5
(c) In a foreign key of R

(d) Only in the primary key of R

Solution: Option (b)

Explanation:

A prime attribute is an attribute that appears in some candidate key of given relation R.
For eg: In relation R(ABCDE), if candidate keys are A, BC then prime attributes are A, B, C.

6. Given an Instance of the STUDENTS relation as shown below:

Student ID Student Name Student Email Student Age


2345 Sowmya Sowmya@math X
1287 Akshaya Akshaya@ee 19
7853 Sowmya Sowmya@cse 19
9876 Akshaya Akshaya@mech 18
8765 Rahul Rahul@civil 19

For (StudentName, StudentAge) to be a key for this instance, the value X should not be equal to

(a) 18 (b) 19

(c) 20 (d) None

Solution: Option (b)

Explanation:

Given, for STUDENTS relation, {StudentName, StudentAge} is key. It means for every tuple
the combination of these two columns is unique. So the combination {Sowmya, 19} should not
repeat in table. Therefore, X value should not be 19.

7. A relation R(ABCDE) with the FD set 𝐹: {𝐴 → 𝐵𝐶, 𝐵𝐶 → 𝐷, 𝐷 → 𝐸}

(i) Above relation can be decomposed into 2NF without violating dependency preservation.

(ii) Above relation can be decomposed into 3NF without violating dependency preservation.

(a) I, II are correct (b) I is correct, II is wrong

(c) I, II are wrong (d) I is wrong, II is correct

6
Solution: Option (a)

Explanation:

Given R(ABCDE) and FD’s: 𝐴 → 𝐵𝐶 ------>①


𝐵𝐶 → 𝐷------>②
𝐷 → 𝐸 ------>③

Finding Candidate key:


A is not present in right hand side of any FD, so A is necessary in every candidate key. So, check
for (𝐴)+ , (𝐴)+ = 𝐴𝐵𝐶𝐷𝐸 . As is able to determine all attributes, A is necessary and sufficient,
so no need to check for other combinations.
Only Candidate key is A, A is prime attribute. B, C and D are non-prime attributes.

Check whether Given FD’s in relation R satisfies 2NF:


A relation R is said to be in 2NF, if they are no partial dependencies in relation R. Partial
dependency means part of key determining non-prime attribute.

FD① is not partial dependency since A is key.

FD② is not partial dependency since left hand side of FD i.e. BC is not part of key (B, C are
non-prime attributes).

FD③is not partial dependency since left hand side of FD i.e. D is not part of key (D is non-
prime attribute).

∴ Given relation is in 2NF and FD is preserving.

Shortcut: If there is only one prime attribute or all the candidate keys contain only one attribute
then R is in 2NF and every 2NF decomposition is FD preserving.
So, statement (i) is correct.

Check whether Given FD’s in relation R satisfies 3NF:


A relation R is said to be in 3NF, if for every non-trivial FD 𝑋 → 𝑌 in R either X is a Superkey
in R or Y is a prime attribute.

FD① satisfies 3NF since left side of FD i.e. A is Superkey.

FD② does not satisfy 3NF since left side of FD i.e. BC is not Superkey and right side of FD i.e.
D is non-prime attribute.

∴ Given relation R does not satisfy 3NF.


So, we need to find (𝐵𝐶)+

(𝐵𝐶)+ = 𝐵𝐶𝐷𝐸

7
Here in relation R(BCDE) D⟶E FD violates 3NF
(∵ D is not Superkey and E is not prime attribute)

So, find (𝐷)+ (𝐷)+ = 𝐷𝐸

∴R(ABCDE) should be decomposed into BCDE and ABC to satisfy 3NF.


Here final FD set we got is {𝐷 → 𝐸, 𝐵𝐶 → 𝐷, 𝐴 → 𝐵𝐶}.

We can say that this can cover the original FD set {𝐴 → 𝐵𝐶, 𝐵𝐶 → 𝐷, 𝐷 → 𝐸}.So given relation
R can be decomposed into 3NF without violating FD preserving.
So, statement II is correct.

Answer is (a).

Shortcut: We know that every 2NF decomposition and 3NF decomposition is lossless and FD
preserving. So option (a) is correct.

Linked Question

Common Data:

8. 𝑅(𝐴𝐵𝐶𝐷𝐸𝐹𝐺𝐻𝐼𝐽) with FD’s 𝐹 = {𝐴 → 𝐵𝐶, 𝐶 → 𝐷, 𝐸 → 𝐹𝐺, 𝐻 → 𝐼𝐽}

(i) How many number of candidate keys are there?

(a) 1 (b) 2

(c) 3 (d) 4

(ii) What is the normal form of the above relation?

8
(a) 1NF (b) 2NF

(c) 3NF (d) BCNF

Solution: Option (i) ⟶ (a), (ii) ⟶(a)

Explanation:

(i) Given relation 𝑅(𝐴𝐵𝐶𝐷𝐸𝐹𝐺𝐻𝐼𝐽) and FD’s

𝐴 → 𝐵𝐶 ------>①
𝐶 → 𝐷 ------>②
𝐸 → 𝐹𝐺 ------>③
𝐻 → 𝐼𝐽 ------>④

Find Candidate key:


A, E, H attributes are not present in right hand side of any FD, so A, E, H is necessary in every
candidate key. Check whether AEH itself is sufficient or not, so check for
(𝐴𝐸𝐻)+ , 𝑎𝑠 (𝐴𝐸𝐻)+ = 𝐴𝐸𝐻𝐵𝐶𝐷𝐹𝐺𝐼𝐽. AEH is necessary and sufficient. So, no need to check
for other candidate keys. Only candidate key is AEH.

∴ No. of candidate keys is 1.

A, E, H are prime attributes.


B, C, D, I, J are non-prime attributes.

Answer is (a).

(ii) Check whether relation R satisfies 2NF:


A relation R is said to be in 2NF if they are no partial dependencies in R. Partial dependency
means part of the key determining non-key attribute.

FD① is partial dependency since left side of FD i.e. A is part of key determining non-prime
attributes B, C.

∴ Normal form of the above relation is 1NF.


Answer is (a).

9. Consider the relation schema of the relation SCHEDULE shown below. What is the highest
normal form of this relation?

SCHEDULE (Stud_ID, Class, Stud_Name, Stud_Major, Class_Time, Building, Room,


Instructor)

9
Assume the following functiuonal dependencies

Stud_ID⟶Stud_Name
Stud_ID⟶Stud_Major
Class ⟶Class_Time
Class ⟶ Building, Room
Class ⟶ Instructor

(a) BCNF (b) 3NF

(c) 2NF (d) 1NF

Solution: Option (d)

Explanation:

Finding Candidate key:

Stud_ID, class is not there in right hand side of any FD. So Stud_ID, class are necessary in every
candidate key. Check whether Stud_ID, class itself is sufficient or not by finding
(𝑆𝑡𝑢𝑑_𝐼𝐷, 𝐶𝑙𝑎𝑠𝑠)+.

As
(𝑆𝑡𝑢𝑑_𝐼𝐷, 𝐶𝑙𝑎𝑠𝑠)+ =
𝑆𝑡𝑢𝑑_𝐼𝐷 𝑆𝑡𝑢𝑑_𝑁𝑎𝑚𝑒 𝑆𝑡𝑢𝑑_𝑀𝑎𝑗𝑜𝑟 𝐶𝑙𝑎𝑠𝑠 𝐶𝑙𝑎𝑠𝑠_𝑇𝑖𝑚𝑒 𝐵𝑢𝑖𝑙𝑑𝑖𝑛𝑔, 𝑅𝑜𝑜𝑚, 𝐼𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑜𝑟.
So, Stud_ID, Class are necessary and sufficient, no need to try for other combinations.

So, Candidate key is (Stud_ID, Class). Stud_ID, Class are prime attributes. Stud_Name,
Stud_Major, Class, Class_Time, Building, Room and Instructor are non-prime attributes.

Checking whether given relation R satisfies 2NF:


A relation R is said to be in 2NF, if there are no partial dependencies in it. Partial dependency
means part of the key determining non-key attribute.

All FD’s in given relation R are partial dependencies. Here left sides of FD’s i.e. Stud_ID, Class
are part of key determining non-prime attributes.

∴Given relation R violates 2NF.

The highest normal form satisfied by R is 1NF. So, answer is Option (d).

10. R = ABCD with FD BC⟶D; under what conditions R is to be in BCNF?

(a) C is not a key for R (b) B is a key for R

10
(c) D is a key for R (d) CD is a key

Solution: Option (b)

Explanation:

We know that a relation R is said to be in BCNF is for every non-trivial FD X⟶Y in R, X


should be a superkey in R
If B is a key in R, then BC will be superkey and so BC⟶D will be in BCNF.

∴ Option (b) is answer.

11. Consider the relational schema 𝑅(𝐴𝐵𝐶𝐷𝐸𝐹𝐺𝐻) and the FD’s {𝐴 ⟶ 𝐵𝐶, 𝐶 ⟶ D, E ⟶
A, F ⟶ GH}. Is the decomposition of R into (𝐸𝐴𝐵𝐶𝐷)(𝐹𝐺𝐻)(𝐸𝐹) is

I. Lossless
II. Lossy
III. Dependency preserving
IV. Not dependency preserving

(a) I & III (b) I & IV

(c) II & III (d) None

Solution: Option (a)

Explanation:

Given 𝑅(𝐴𝐵𝐶𝐷𝐸𝐹𝐺𝐻) and FD’s 𝐴 → 𝐵𝐶


𝐶→𝐷
𝐸→𝐴
𝐹 → 𝐺𝐻

and decomposed tables are (EABCD) (FGH) (EF). So the FD’s can be divided as

11
Finding Candidate key for (EABCD):

E is not there in right hand side of any FD so E is necessary in every candidate key. Check
whether E itself is sufficient to be a candidate key. As (𝐸)+ = 𝐸𝐴𝐵𝐶𝐷 , E is determining all
attributes in R, we can say E is necessary and sufficient, so E is only candidate key for EABCD.

Finding Candidate key for (FGH) :

F is not present in right hand side of any FD so F is necessary in every candidate key. Check
whether F itself is sufficient to be a candidate key. As (𝐹)+ = 𝐹𝐺𝐻 , F is determining all
attributes in R, we can say F is necessary and sufficient, so F is only candidate key for FG.
Candidate key for (EF) is EF as they are no FD’s under it.
So, the decomposed tables are

Checking for lossless decomposition:


The above decomposition is lossless (∵We know that a decomposition is lossless if common
attribute of two decomposed relations is key for atleast one table).

Here between EABCD and EF the common attribute is E which is key for EABCD and also the
common attribute between FGH and EF is F which is key in FGH. So, the above decomposition
is lossless, and there are no spurious tables, when we perform natural join on these tables.

Here if we want to join tables EABCD and FGH, first we combine tables EABCD and EF and
then we combine the resultant table with FGH. So, with given E value, we can find F value from
final table.

Checking for FD preserving:

Final FD set after decomposition:


{𝐸 → 𝐴, 𝐴 → 𝐵𝐶, 𝐶 → 𝐷, 𝐹 → 𝐺𝐻}

Original FD set:
{𝐴 → 𝐵𝐶, 𝐶 → 𝐷, 𝐸 → 𝐴, 𝐹 → 𝐺𝐻}
It is clear that original FD set and final FD set after decomposition is same.

Here we can cover original FD set by final FD set.


∴Above decomposition is FD preserving.

12
∴Given decomposition is lossless and FD preserving.
So, answer is (a).

12. R(ABCD) is a relation. Which of the following FDs while holding on ‘R’ does not have
either lossless join or dependency preserving BCNF decomposition?

(a) A⟶B, C⟶D (b) AB⟶C, B⟶C, C⟶D

(c) AC⟶D, A⟶BC (d) AB⟶CD, C⟶A

Solution: Option (d)

Explanation:

We know that a relation R is said to be in BCNF, if for every non-trivial FD X⟶Y in R, X is a


superkey in R.

Check for Option (a):

Given FD’s A⟶B ----->①


C⟶D ----->②

Find Candidate key:


A, C are not there in right hand side of any FD, so A, C are necessary in every candidate key.
Check whether AC is sufficient itself to be a candidate key, so find (𝐴𝐶)+ = 𝐴𝐵𝐶𝐷. As (𝐴𝐶)+
is determining all attributes we can say AC is necessary and sufficient, no need to check for other
combinations to find Candidate key. AC is the only candidate key of R.

FD① does not satisfy BCNF (∵ A is not superkey in R)


So find (𝐴)+ = 𝐴𝐵

Here C⟶D in ACD does not satisfy BCNF so find


(𝐶)+ = 𝐶𝐷

13
The above decomposition is lossless (∵ common attribute of AB and AC is A and A is candidate
key in AB, common attribute of CD and AC is C and C is key in CD)

This decomposition is also FD preserving (∵ Final FD set {A⟶B, C⟶D} covers original FD set
{A⟶B, C⟶D}
∴ Given FD’s in relation R has lossless and FD preserving BCNF decomposition.
So, option (a) is not answer.

Check for Option (b):


Given FD’s 𝐴𝐵 → 𝐶 ----->①
𝐵 → 𝐶----->②
𝐶 → 𝐷 ----->③

Find Candidate key:

A, B are not there in right hand side of any FD, so A, B are necessary in every candidate key.
Check whether AB is sufficient itself to be a candidate key, so find (𝐴𝐵)+ = 𝐴𝐵𝐶𝐷. As (𝐴𝐵)+
is determining all attributes we can say AB is necessary and sufficient, no need to check for other
combinations to find Candidate key. AB is the only candidate key of R
FD① is satisfying BCNF (∵ AB is Superkey in R)

FD② is not satisfying BCNF so find (𝐵)+ = 𝐵𝐶𝐷

In table BCD C⟶D is not satisfying BCNF, so find (𝐶)+ = 𝐶𝐷.

Table BCD can be decomposed as

14
So table ABCD can be decomposed as

All tables CD, BC, AB are satisfying BCNF (∵ C is key in CD and B is key in BC).

Decomposition is lossless (∵ Common attribute of CD and BC is C which is candidate key in


CD, common attribute of BC and AB is B which is candidate key in BC).

Decomposition is also FD preserving since FD’s {C⟶D, B⟶C} which are final FD’s after
decomposition can cover original FD set {AB⟶C, B⟶C, C⟶D}. It seems AB⟶C is not
present in final FD set but if we find (𝐴𝐵)+ in final FD set
(𝐴𝐵)+ = 𝐴𝐵𝐶𝐷 ⟹ 𝐴𝐵 ⟶ 𝐶

So 𝐴𝐵 ⟶ 𝐶 which is present in original FD set can be covered by final FD set obtained after
decomposition.
So, given FD’s has lossless and FD preserving BCNF decomposition.

So Option (b) is not answer.

Check for Option (c):


Given FD’s
𝐴𝐶 → 𝐷 ----->①
𝐴 → 𝐵𝐶 ------>②

Find Candidate key:

A is not there in right hand side of any FD, so A is necessary in every candidate key. Check
whether A itself is sufficient to be a candidate key, so find (𝐴)+ = 𝐴𝐵𝐶𝐷. As (𝐴)+ is
determining all attributes we can say A is necessary and sufficient, no need to check for other
combinations to find Candidate key. A is the only candidate key of R

FD① satisfies BCNF, since left side of FD i.e. AC is Superkey in R.

15
FD② satisfies BCNF, since left side of FD i.e. A is Superkey in R.

Given relation R is already in BCNF, no need to decompose it.


∴Option (c) is not answer.

Check for Option (d):


Given FD’s 𝐴𝐵 → 𝐶𝐷 ----->①
𝐶 → 𝐴 ------>②

Find Candidate key:

B is not there in right hand side of any FD, so B is necessary in every candidate key. Check
whether B itself is sufficient to be a candidate key. As (𝐵)+ = 𝐵, B is not a key.

Check for combination of 2 attributes including B like AB, BC, BD and find closures of them.
Only (𝐴𝐵)+ = 𝐴𝐵𝐶𝐷 and (𝐵𝐶)+ = 𝐵𝐶𝐴𝐷
∴ AB, BC are Candidate keys.

Check for combination of three attributes including B but excluding BA, BC ( As AB and AC
are already candidate keys , so any combination with them will become superkey) . There are no
such combinations. So, no need to check for them.
∴ AB, AC are Candidate keys for given relation R.

A, B, C are prime attributes. D is non-prime attribute.

FD① satisfies BCNF (∵ left side of FD i.e. AB is Superkey in R)

FD② does not satisfy BCNF (∵left side of FD i.e. C is not Superkey)

So find (𝐶)+ :
(𝐶)+ = 𝐶𝐴

New tables CA and BCD are satisfying BCNF decompositions since C is Superkey in CA.

It is also lossless decomposition since common attribute of tables CA and BCD is C which is key
for table CA.

16
It is not FD preserving, since final FD set {𝐶 → 𝐴}cannot cover original FD set {𝐴𝐵 → 𝐶𝐷, 𝐶 →
𝐴} because if we find (𝐴𝐵)+ in {𝐶 → 𝐴}(𝐴𝐵)+ = 𝐴𝐵

∴ AB⟶CD cannot be covered by final FD set {𝐶 → 𝐴}


∴Given FD’s decomposition into BCNF is lossless and not FD preserving. So Option (d) is
answer.

13. Given R = ABCDE and FD set {𝐴𝐵 → 𝐶𝐷, 𝐸 → 𝐴, 𝐷 → 𝐸}. If we decompose into BCNF,
how many tables we will get?

(a) 2 (b) 3

(c) 4 (d) 5

Solution: Option (b)

Explanation:

Given R(ABCDE) and FD’s : {𝐴𝐵 → 𝐶𝐷, 𝐸 → 𝐴, 𝐷 → 𝐸}

Find out Candidate key:

B is not there in right hand side of FD’s, so find (𝐵)+ = 𝐵. So, B is not Candidate key.

Try for all combinations of two attributes including B such as BA, BC, BD, BE.
Only (𝐵𝐴)+ = 𝐵𝐴𝐶𝐷𝐸, (𝐵𝐸)+ = 𝐵𝐸𝐴𝐶𝐷, (𝐵𝐷)+ = 𝐵𝐷𝐸𝐴𝐶. So AB, BE, BD are Candidate
keys. Now try for the combinations of all three attributes including B but excluding BA,BE, BD .
There are no such combinations, so need to try for that.

Decompose Given relation into BCNF:


We know that a relation R is said to be in BCNF, if for every non-trivial FD X⟶Y in R, X is a
superkey in R.

Given FD’s : AB⟶CD ----->①


E ⟶ A ----->②
D ⟶ E ----->③

FD① is satisfying BCNF since left side of FD i.e. AB is Superkey.

FD② is not satisfying BCNF, since left side of FD i.e. E is not Superkey.

∴ Find (𝐸)+ = 𝐸𝐴

17
ABCDE can be decomposed as

Here table EA is satisfying BCNF, but table BCDE is not satisfying BCNF since left side of FD
(D⟶E) i.e. D is not Superkey. So find (𝐷)+ = 𝐷𝐸

Table BCDE can be decomposed as

Tables DE and BCD are in BCNF.

So, the final decomposition of R(ABCDE), such that decomposed tables satisfying BCNF is

∴ No. of tables after BCNF decomposition is 3.

Answer is (b).

14. From the following instance of a relation schema R(A, B, C) we can conclude that

A B C
𝑎1 𝑏1 𝑐1
𝑎1 𝑏1 𝑐2
𝑎2 𝑏2 𝑐3
𝑎2 𝑏2 𝑐3

(a) A functionally determines B and B functionally determines C.

18
(b) A functionally determines B and B does not functionally determines C.

(c) B does not functionally determine C.

(d) A does not functionally determines B and B does not functionally determines C.

Solution: Option (c)

Explanation: FDs are decided from the requirement analysis phase first, then tables are formed
using FDs and normalization. So from given instance of a relation schema we can only say that
certain FDs do not hold, but cannot say which FDs hold on R, because even if an FD holds on
the current instance, it may not hold as the table grows.

From the given instance we can only say that B functionally does not determines C because for
given b1 of B, C has c1 and c2 values, but we cannot say that A functionally determines B for
the entire relation itself. This is because A → B holds for this instance, but in future there might
be some tuples added to the instance that may violate A→B.

∴ C is Answer.

15. Which of the following statements is false?

(a) Any relation with 2 attributes is in BCNF.

(b) Any relation in which every key has only one attribute is in 2NF.

(c) A prime attribute can be transitively dependent on a key in a 3NF relation.

(d) A prime attribute can be transitively dependent on a key in a BCNF relation.

Solution: Option (d)

Explanation:

In BCNF, a prime attribute should not transitively dependent on a key, as every determinant
should be a Superkey in BCNF.

For example consider relation R(ABCD) and FD’s on R: { AB→C, C→B}

Find Candidate key:

A is not there in right hand side of any FD, so A is necessary in every candidate key. Check for
A is sufficient itself to be a candidate for R. So check for𝐴+ . As 𝐴+ = A, A is not determining all
attributes. Therefore A is not candidate key. Try for all two combination attributes including A.
We have to try AB, AC. AB and AC are candidate keys since (𝐴𝐵)+ = ABCD and (𝐴𝐶)+ =

19
ABCD. Now try for three combination attributes including A but excluding AB and AC (AB I
and AC are already candidate keys, so any combination with AB and AC will become superkey).

Therefore AB and AC are the only candidate keys in R. A, B, C are prime attributes.

Here AB→C is in BCNF since left hand side of FD i.e AB is superkey in R.

But C→B is not in BCNF, since C is not superkey in R. Here the prime attribute ‘B’ is
transitively depending on key ‘AB’ and is not satisfying BCNF. So we can say “A prime
attribute cannot be transitively dependent on a key in BCNF “.

16. Given relation schema R (ABCDEH) with FD’s:{𝐴 → 𝐵, 𝐵𝐶 → 𝐷, 𝐸 → 𝐶, 𝐷 → 𝐴}. Find


Candidate keys for relation R.

(a) AE, BF, DE (b) AEH, BEH, DEH

(c) AEH, BEH, CEH, DEH (d) AE, BE, CE

Solution: Option (b)

Explanation:

Given FD’s A→ 𝐵
𝐵𝐶 → 𝐷
𝐸→𝐶
𝐷→𝐴

E, H are not present in right hand side of any FD, so E, H are necessary in every candidate key.
Check whether E, H is sufficient itself to be a candidate key for R. So find (𝐸𝐻)+ . As (𝐸𝐻)+ =
𝐸𝐻𝐶, So EH is not Candidate key.
Try the combination of 3 attributes including EH like
AEH, BEH, CEH, DEH

(𝐴𝐸𝐻)+ = 𝐴𝐸𝐻𝐵𝐶𝐷 (𝐴𝐸𝐻 𝑖𝑠 𝑐𝑎𝑛𝑑𝑖𝑑𝑎𝑡𝑒 𝑘𝑒𝑦)


(𝐵𝐸𝐻)+ = 𝐵𝐸𝐻𝐶𝐷 (𝐵𝐸𝐻 𝑖𝑠 𝑐𝑎𝑛𝑑𝑖𝑑𝑎𝑡𝑒 𝑘𝑒𝑦)
(𝐶𝐸𝐻)+ = 𝐶𝐸𝐻 (𝐶𝐸𝐻 𝑖𝑠 𝑛𝑜𝑡 𝑐𝑎𝑛𝑑𝑖𝑑𝑎𝑡𝑒 𝑘𝑒𝑦)
(𝐷𝐸𝐻)+ = 𝐷𝐸𝐻𝐴𝐶𝐵 (𝐷𝐸𝐻 𝑖𝑠 𝑐𝑎𝑛𝑑𝑖𝑑𝑎𝑡𝑒 𝑘𝑒𝑦)

∴ 𝐴𝐸𝐻, 𝐵𝐸𝐻, 𝐷𝐸𝐻 𝑎𝑟𝑒 𝐶𝑎𝑛𝑑𝑖𝑑𝑎𝑡𝑒 𝑘𝑒𝑦𝑠.

Try for combination of 4 attributes including EH but excluding AEH, BEH, DEH.
There is no such combination.

20
∴ 𝐴𝐸𝐻, 𝐵𝐸𝐻, 𝐷𝐸𝐻 𝑎𝑟𝑒 𝑡ℎ𝑒 𝑜𝑛𝑙𝑦 𝐶𝑎𝑛𝑑𝑖𝑑𝑎𝑡𝑒 𝑘𝑒𝑦𝑠. 𝑆𝑜 𝑂𝑝𝑡𝑖𝑜𝑛 (𝑏) 𝑖𝑠 𝑎𝑛𝑠𝑤𝑒𝑟.

17. A relation R(ABCDE) and the dependency set


𝐹 = {𝐴𝐵 → 𝐶𝐷, 𝐶 → 𝐷𝐸, 𝐴 → 𝐵}. Find the normal form of above relation.

(a) 2NF (b) 1NF

(c) 3NF (d) BCNF

Solution: Option (a)

Explanation:

Given FD’s 𝐴𝐵 → 𝐶𝐷 ----->①


C ⟶ DE ------>②
𝐴→𝐵 ------>③

Find Candidate key:


A is not there in right hand side of any FD. So A is necessary in every candidate key. Find (𝐴)+
(𝐴)+ = 𝐴𝐵𝐶𝐷𝐸, as (𝐴)+ is determining all attributes, A is sufficient. Since A is necessary and
sufficient A is the only candidate key of R. A is prime attribute. B, C, D, E are non-prime
attributes.

Checking whether relation R violates 2NF:


A relation R is said to be in 2NF, if there are no partial dependencies in it. Partial dependency is
nothing but a part of the key determining non-key attribute.

FD① is satisfying 2NF as it is not partial dependency.

FD②, FD③ are satisfying 2NF as they are not partial dependencies.

Shortcut: If there is only one prime attribute or all the candidate keys contain only one attribute
then R is in 2NF.

Given relation R is in 2NF.

Check whether R satisfies 3NF:


Formal definition of 3NF states that a relation R is said to be in 3NF if for every non-trivial FD
X⟶Y in R either X is a Superkey of R or Y is a prime attribute.

FD① does not violate 3NF since AB is Superkey.

FD② violates 3NF since left side of FD i.e. C is not Superkey and right side of FD i.e. D, E are
not prime attributes.

21
∴ 𝑅𝑒𝑙𝑎𝑡𝑖𝑜𝑛 𝑅 𝑣𝑖𝑜𝑙𝑎𝑡𝑒𝑠 3𝑁𝐹.
∴ 𝐺𝑖𝑣𝑒𝑛 𝑟𝑒𝑙𝑎𝑡𝑖𝑜𝑛 𝑅 𝑖𝑠 𝑖𝑛 2𝑁𝐹.

So, answer is (a).

18. A relation R(ABCDE) and the dependency set 𝐹 = {𝐴 → 𝐵, 𝐶 → 𝐷, 𝐴 → 𝐸}.


Can you decompose the above into BCNF without violating dependency preservation?

(a) Yes (b) No

(c) Can’t say (d) None

Solution: Option (a)

Explanation:

Find Candidate key:


A, C attributes are not present in right hand side of any FD. So A, C are necessary in every
candidate key. Check whether A, C are sufficient itself to be candidate key. So find(𝐴𝐶)+ ,
𝐴𝑠 (𝐴𝐶)+ = 𝐴𝐶𝐷𝐵𝐸, AC is necessary and sufficient to be candidate key. Therefore AC is only
candidate key and no need to check for other combinations for candidate key. A, C are prime
attributes, B, D, E are non prime attributes.
Given FD’s A⟶B ----->①
C⟶D ----->②
A⟶E ----->③

Formal definition of BCNF states that for every non-trivial FD X⟶Y in R, X should be
Superkey in R.

FD① violates BCNF since A is not Superkey in R.


So find (𝐴)+ = 𝐴𝐵𝐸

Decomposed table ABE is in BCNF, since left side of all FD’s is Superkey (∵ A is key is ABE)

Decomposed table ACD is not in BCNF, Since left side of FD C⟶D i.e. C is not Superkey in
ACD (∵ AC is key in ACD)

22
∴ACD can be decomposed as

Final decomposition of ABCD is

∴ Final FD set after BCNF decomposition of given relation R is


{𝐴 → 𝐵, 𝐴 → 𝐸, 𝐶 → 𝐷}

Clearly we can say that this can cover original FD set


{𝐴 → 𝐵, 𝐴 → 𝐸, 𝐶 → 𝐷}

∴ Decomposition of given relation R into BCNF is FD preserving.


So, answer is (a).

19. A decomposition of a relation schema 𝑅 < 𝑆, 𝐹 >into relation schemas 𝑅𝑖 (1 ≤ 𝑖 ≤ 𝑛) then if


for every relation state r of R,
𝑅 ⊂ 𝛱𝑅1 (𝑟) ⋈ 𝛱𝑅2 (𝑟) ⋈ 𝛱𝑅3 (𝑟) … … … . ⋈ 𝛱𝑅𝑛 (𝑟), then
Such a decomposition is called

(a) dependency preserving

(b) lossy

(c) Neither (a) nor (b)

(d) Both (a) and (b)

Solution: Option (b)

Explanation:

23
A decomposition of a relation 𝑅 < 𝑆, 𝐹 > into relation schemas 𝑅𝑖 (1 ≤ 𝑖 ≤ 𝑛) is said to be a
lossless join decomposition or simply lossless if for every relation state r of R that satisfies FD in
F, the natutal join of the projections of R gives the original relation R i.e. R should be equal to

𝛱𝑅1 (𝑟) ⋈ 𝛱𝑅2 (𝑟) ⋈ 𝛱𝑅3 (𝑟) … … … . ⋈ 𝛱𝑅𝑛 (𝑟)

But if 𝑅 ⊂ 𝛱𝑅1 (𝑟) ⋈ 𝛱𝑅2 (𝑟) ⋈ 𝛱𝑅3 (𝑟) … … … . ⋈ 𝛱𝑅𝑛 (𝑟)


then decomposition is lossy and spurious tuples are present in resultant table after applying
natural join on the decomposed tables.

20. Given R=ABCDE and FD’s :{𝐴𝐵 → 𝐶𝐷𝐸, 𝐶 → 𝐴, 𝐷 → 𝐸}. If we decompose into BCNF, it is
FD preserving.

(a) Yes (b) No

(c) Can’t say (d) None

Solution: Option (b)

Explanation:

Given R (ABCDE) and FD’s: AB ⟶ CDE ----->①


C⟶A ----->②
D⟶E ----->③

To decompose into BCNF, we have to find Candidate key.

Finding Candidate key:


B is not present in right hand side of any FD, so B is necessary in every candidate key. Check
whether B itself is sufficient to be candidate key. Find 𝐵 + . 𝐴𝑠 𝐵 + = 𝐵, B is not Candidate key.
Try for the combination of two attributes including B like AB, AC, AD, AE. Only BC, AB are
candidate keys as only (𝐵𝐶)+ = 𝐵𝐶𝐴𝐷𝐸 and (𝐵𝐴)+ = 𝐵𝐶𝐴𝐷𝐸.

In the same way, try for combination of three attributes candidate keys including B but excluding
AB and AC (Since AB and AC are candidate keys any combination with them will become super
key). We have to try BDE. Find(𝐵𝐷𝐸)+ . As (𝐵𝐷𝐸)+ = BDE. BDE is not candidate key as BDE
is not determining all attributes. Try for combination of four attribute candidate keys including B
but excluding AB and BC, but there are no such combinations. So the candidate keys for the
given relation is AB, AC. Therefore A,B,C are prime attributes and D,E are non prime attributes.

Type equation here.

24
We know that a relation R is said to be in BCNF if in every non-trivial FD X⟶Y in R, X is a
Superkey in R.

① is in BCNF (∵ AB is Superkey)

② is not in BCNF (∵ C is not Superkey)

So find (𝐶)+ = 𝐶𝐴

Decompose table ABCDE into

Here table BCDE is not in BCNF (∵ left side of FD D⟶E i.e. D is not Superkey in BCDE
because BCD is key in BCDE)

∴ 𝐵𝐶𝐷𝐸 should be decomposed as

Tables BCD and DE are in BCNF.

So, final decomposition of ABCDE is

Final FD set after decomposition is


{𝐶 → 𝐴, 𝐷 → 𝐸}

Checking whether the decomposition is FD preserving:


All FD’s except AB⟶CDE in original FD’s was there in final FD set. We have to check
whether AB⟶CDE can be derived from final FD set.

25
Final FD set :{𝐶 → 𝐴, 𝐷 → 𝐸}
(𝐴𝐵)+ = 𝐴𝐵

So, AB⟶CDE cannot be derived from final FD set.

We can say given BCNF decomposition is not FD preserving.

So the answer is (b).

26

You might also like