DBMS Solved QP
DBMS Solved QP
H}, {D}→{I, J} }. What is the key for R? Decompose R into 2NF and then 3NF
Relations
your answer
No. The closure of AB does not give you all of the attributes of the
relation.
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
18.Given below are two sets of FDs for a relation R(A,B,C,D,E) are they equivalent?
2.A BC,D AE
CE -> A and CF-> B can be eliminated. C -> A makes CE -> A redundant. CF -> D makes
CF -> B redundant.
Ans:
AB -> C
C -> A
BC -> D
CD -> B
BE -> C
CE -> F
CF -> D
D -> E
21.Prove and disprove the following inference rules for functional dependencies
Explain
NF.
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
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
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.
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.
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.
Since due to FD: PQ → R, PS → VW, QS → TU, P → X our table was not in 2NF, let's decompose the table
And create one table for the key, since the key is PQS.
R6(P, Q, S)
R1(P, Q, R)
R2( P, S, V, W)
R3( Q, S, T, U)
R4( P, X)
R5( W, Y)
R6(P, Q, S)
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
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.
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
Since due to FD: A →B and C → D our table was not in 2NF, let's decompose the table
a. R1( A, B, E)
b. R2( C, D)
c. R3( A, C)
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.
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
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
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)
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
Since we have just proved that above table R is in 2 NF. Let's check it for 3NF using
definition 2.
Since due to FD: Y → Z, our table was not in 3NF, let's decompose the table
R1(X, Y)
R2(Y, Z)