0% found this document useful (0 votes)
51 views10 pages

DBMS Solved QP

The document discusses various aspects of database normalization, including determining candidate keys, checking for 2NF and 3NF compliance, and decomposing relations into normalized forms. It provides examples of functional dependencies and illustrates the process of finding minimum covers and equivalence sets. Additionally, it explains the definitions and requirements for 2NF and 3NF, along with practical applications in relation schemas.

Uploaded by

vishnudevadiga24
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)
51 views10 pages

DBMS Solved QP

The document discusses various aspects of database normalization, including determining candidate keys, checking for 2NF and 3NF compliance, and decomposing relations into normalized forms. It provides examples of functional dependencies and illustrates the process of finding minimum covers and equivalence sets. Additionally, it explains the definitions and requirements for 2NF and 3NF, along with practical applications in relation schemas.

Uploaded by

vishnudevadiga24
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/ 10

16.

Consider the universal relation R = {A, B, C, D, E, F, G, H, I, J} and the set of

functional dependencies F = { {A, B}→{C}, {A}→{D, E}, {B}→{F}, {F}→{G,

H}, {D}→{I, J} }. What is the key for R? Decompose R into 2NF and then 3NF

Relations

17.Consider a relation R(A, B, C, D, E) with the following dependencies: AB → C,

CD → E, DE → B Is AB a candidate key of this relation? If not, is ABD? Explain

your answer
No. The closure of AB does not give you all of the attributes of the
relation.

If not, is ABD? Explain your answer.

A -> A
B -> B
C -> C
D -> D
E -> E
AB -> ABC
AC -> AC
AD -> AD
AE -> AE
BC -> BC
BD -> BD
BE -> BE
CD -> BCDE
CE -> CE
DE -> BDE

ABD -> ABCDE


Yes, ABD is a candidate key. No subset of its attributes is a key.

18.Given below are two sets of FDs for a relation R(A,B,C,D,E) are they equivalent?

1.A- B,AB C,D AC,D E

2.A BC,D AE

19.A set of FDs for the relation R {A, B, C, D, E, F} is AB C, C A, BC D,

ACD B, BE C, EC FA, CF BD, D E. Find a minimum cover for

this set of FDs.

CE -> A and CF-> B can be eliminated. C -> A makes CE -> A redundant. CF -> D makes
CF -> B redundant.

C)+ contains A, so ACD -> B can be reduced to CD -> B.

Ans:

AB -> C

C -> A

BC -> D

CD -> B

BE -> C
CE -> F

CF -> D

D -> E

20.Prove that any relation schema with two attributes is in BCNF

21.Prove and disprove the following inference rules for functional dependencies

Explain

22.Equivalence sets of Functional dependencies

23.Minimal sets of Functional dependencies.

24.Given a relation R( A, B, C, D) and Functional Dependency set FD = { AB →

CD, B → C }, determine whether the given R is in 2NF? If not convert it into 2

NF.

25.Given a relation R( P, Q, R, S, T) and Functional Dependency set FD = { PQ →

R, S → T }, determine whether the given R is in 2NF? If not convert it into 2 NF.

Let us calculate the closure of AB

AB + = ABCD (from the method we studied earlier)

Since the closure of AB contains all the attributes of R, hence AB is Candidate Key

From the definition of Candidate Key(Candidate Key is a Super Key whose no proper
subset is a Super key)

Since all key will have AB as an integral part, and we have proved that AB is Candidate
Key, Therefore, any superset of AB will be Super Key but not Candidate key.
Hence there will be only one candidate key AB

Definition of 2NF: No non-prime attribute should be partially dependent on Candidate


Key

Since R has 4 attributes: - A, B, C, D, and Candidate Key is AB, Therefore, prime attributes
(part of candidate key) are A and B while a non-prime attribute are C and D

26.. Given a relation R( P, Q, R, S, T, U, V, W, X, Y) and Functional Dependency set

FD = { PQ → R, PS → VW, QS → TU, P → X, W → Y }, determine whether the

given R is in 2NF? If not convert it into 2 NF.

Solution: Let us construct an arrow diagram on R using FD to calculate the candidate key.

QUESTIONS ON NORMALIZATION

From above arrow diagram on R, we can see that an attributes PQS is not determined by any of the
given FD, hence PQS will be the integral part of the Candidate key, i.e. no matter what will be the
candidate key, and how many will be the candidate key, but all will have PQS compulsory attribute.

Let us calculate the closure of PQS

PQS + = P Q S R T U V W X Y (from the closure method we studied earlier)

Since the closure of PQS contains all the attributes of R, hence PQS is Candidate Key

From the definition of Candidate Key(Candidate Key is a Super Key whose no proper subset is a Super
key)

Since all key will have PQS as an integral part, and we have proved that PQS is Candidate Key, Therefore,
any superset of PQS will be Super Key but not a Candidate key.

Hence there will be only one candidate key PQS


Definition of 2NF: No non-prime attribute should be partially dependent on Candidate Key

Since R has 10 attributes: - P, Q, R, S, T, U, V, W, X, Y, and Candidate Key is PQS calculated using FD = {


PQ → R, PS → VW, QS → TU, P → X, W → Y }. Therefore, prime attribute(part of candidate key) are P, Q,
and S while non-prime attribute are R, T, U, V, W, X and Y

FD: PQ → R does not satisfy the definition of 2NF, that non-prime attribute( R) is partially dependent on
part of candidate key PQS

FD: PS → VW does not satisfy the definition of 2NF, that non-prime attribute( VW) is partially dependent
on part of candidate key PQS

FD: QS → TU does not satisfy the definition of 2NF, that non-prime attribute( TU) is partially dependent
on part of candidate key PQS

FD: P → X does not satisfy the definition of 2NF, that non-prime attribute( X) are partially dependent on
part of candidate key PQS

FD: W → Y does not violate the definition of 2NF, as the non-prime attribute(Y) is dependent on the
non-prime attribute(W), which is not related to the definition of 2NF.

Hence because of FD: PQ → R, PS → VW, QS → TU, P → X the above table R( P, Q, R, S, T, U, V, W, X, Y) is


not in 2NF

Convert the table R( P, Q, R, S, T, U, V, W, X, Y) in 2NF:

Since due to FD: PQ → R, PS → VW, QS → TU, P → X our table was not in 2NF, let's decompose the table

R1(P, Q, R) (Now in table R1 FD: PQ → R is Full F D, hence R1 is in 2NF)

R2( P, S, V, W) (Now in table R2 FD: PS → VW is Full F D, hence R2 is in 2NF)

R3( Q, S, T, U) (Now in table R3 FD: QS → TU is Full F D, hence R3 is in 2NF)

R4( P, X) (Now in table R4 FD : P → X is Full F D, hence R4 is in 2NF)


R5( W, Y) (Now in table R5 FD: W → Y is Full F D, hence R2 is in 2NF)

And create one table for the key, since the key is PQS.

R6(P, Q, S)

Finally, the decomposed tables which is in 2NF are:

R1(P, Q, R)

R2( P, S, V, W)

R3( Q, S, T, U)

R4( P, X)

R5( W, Y)

R6(P, Q, S)

27. Given a relation R( A, B, C, D, E) and Functional Dependency set FD = { A → B,

B → E, C → D}, determine whether the given R is in 2NF? If not convert it into 2

NF.

Solution: Let us construct an arrow diagram on R using FD to calculate the candidate key.

From above arrow diagram on R, we can see that an attributes AC is not determined by
any of the given FD, hence AC will be the integral part of the Candidate key, i.e. no matter
what will be the candidate key, and how many will be the candidate key, but all will have
W compulsory attribute.
Let us calculate the closure of AC

AC + = ACBED( from the closure method we studied earlier)

Since the closure of AC contains all the attributes of R, hence AC is Candidate Key

From the definition of Candidate Key(Candidate Key is a Super Key whose no proper
subset is a Super key)

Since all key will have AC as an integral part, and we have proved that AC is Candidate
Key, Therefore, any superset of AC will be Super Key but not Candidate key.

Hence there will be only one candidate key AC

Definition of 2NF: No non-prime attribute should be partially dependent on Candidate


Key

Since R has 5 attributes: - A, B, C, D, E and Candidate Key is AC, Therefore, prime attribute
(part of candidate key) are A and C while the non-prime attribute are B D and E

a. FD: A → B does not satisfy the definition of 2NF, as a non-prime attribute(B) is


partially dependent on candidate key AC (i.e., key should not be broken at any cost).
b. FD: B → E does not violate the definition of 2NF, as a non-prime attribute(E) is
dependent on the non-prime attribute(B), which is not related to the definition of
2NF.
c. FD: C → D does not satisfy the definition of 2NF, as a non-prime attribute(D) is
partially dependent on candidate key AC (i.e., key should not be broken at any cost)

Hence because of FD A → B and C → D, the above table R( A, B, C, D, E) is not in 2NF

Convert the table R(A, B, C, D, E) in 2NF:

Since due to FD: A →B and C → D our table was not in 2NF, let's decompose the table

R1(A, B, E) ( from FD: A → B and B → E and both are violating 2 NF definition)

R2( C, D) (Now in table R2 FD: C → D is Full F D, hence R2 is in 2NF)

And create one table for candidate key AC


R3 ( A, C)

Finally, the decomposed tables which are in 2NF:

a. R1( A, B, E)
b. R2( C, D)
c. R3( A, C)

28.Given a relation R( X, Y, Z) and Functional Dependency set FD = { X → Y and Y

→ Z }, determine whether the given R is in 3NF? If not convert it into 3 NF.

29.Given a relation R( X, Y, Z, W, P) and Functional Dependency set FD = { X → Y,

Y → P, and Z → W}, determine whether the given R is in 3NF? If not convert it

into Solution: Let us construct an arrow diagram on R using FD to calculate the candidate
key.

From above arrow diagram on R, we can see that an attribute X is not determined by any
of the given FD, hence X will be the integral part of the Candidate key, i.e. no matter what
will be the candidate key, and how many will be the candidate key, but all will have X
compulsory attribute.

Let us calculate the closure of X

X + = XYZ (from the closure method we studied earlier)

Since the closure of X contains all the attributes of R, hence X is Candidate Key

From the definition of Candidate Key (Candidate Key is a Super Key whose no proper
subset is a Super key)

Since all key will have X as an integral part, and we have proved that X is Candidate Key,
Therefore, any superset of X will be Super Key but not the Candidate key.
Hence there will be only one candidate key X

Definition of 3NF: A relational schema R is said to be in 3NF, First, it should be in 2NF


and, no non-prime attribute should be transitively dependent on the Key of the table.

If X → Y and Y → Z exist then X → Z also exists which is a transitive dependency, and it


should not hold.

Since R has 3 attributes: - X, Y, Z, and Candidate Key is X, Therefore, prime attribute (part
of candidate key) is X while a non-prime attribute are Y and Z

Given FD are X → Y and Y → Z

So, we can write X → Z (which is a transitive dependency)

In above FD X → Z, a non-prime attribute( Z) is transitively depending on the key of the


table( X ) hence as per the definition of 3NF it is not in 3 NF, because no non-prime
attribute should be transitively dependent on the key of the table.

Now check the above table is in 2 NF.

a. FD: X → Y is in 2NF ( as Key is not breaking and its Fully functional dependent )
b. FD: Y → Z is also in 2NF( as it does not violate the definition of 2NF)

Hence above table R( X, Y, Z ) is in 2NF but not in 3NF.

We can also prove the same from Definition 2: First, it should be in 2NF and if there
exists a non-trivial dependency between two sets of attributes X and Y such that X → Y
(i.e., Y is not a subset of X) then

a. Either X is Super Key


b. Or Y is a prime attribute.

Since we have just proved that above table R is in 2 NF. Let's check it for 3NF using
definition 2.

a. FD: X → Y is in 3NF (as X is a super Key)


b. FD: Y → Z is not in 3NF (as neither Y is Key nor Z is a prime attribute)
Hence because of Y → Z using definition 2 of 3NF, we can say that above table R is not in
3NF.

Convert the table R( X, Y, Z) into 3NF:

Since due to FD: Y → Z, our table was not in 3NF, let's decompose the table

FD: Y → Z was creating issue, hence one table R1(Y, Z)

Create one Table for key X, R2(X, Y), since X → Y

Hence decomposed tables which are in 3NF are:

R1(X, Y)

R2(Y, Z)

You might also like