Questions on Super Keys and Candidate Keys using Closure


Identify Super Keys and Candidate keys :

Question 1 :
 Let R(ABCDE) is a relational schema, where
  (AB)+ = ABCDE  
  (A)+ = ABCDE 
 Is AB: Candidate Key or Not??
Solution :
 AB : Not a Candidate Key, AB is only : Super Key
Question 2 :
 Let R(ABCDE) is a relational Schema having FDs 
  {AB→C, C→D, B→E}
  Find out the Candidate Key ?
Solution :
 (AB+) : {ABCDE}   ⇒ super key
  (A+) : {A}   ×
  (B+) : {EB}   ×
  ∴ AB : minimal superkey ⇒ Candidate Key. No subset of its attributes is a key.
Question 3 :
 Let R(ABCDE) is a relational schema having FDs
  {AB→C , C→D, B→EA}
  Find Out the Candidate Key ?
Solution :
 (AB+) : {ABCDE}   ⇒Superkey
  (A+)  : {A}
  (B+)  :  {EABCD}  ⇒ Superkey
  ⇒ B is Candidate Key.
Question 4 :
 Let R(ABCDE) is a relational schema having FDs
  {A→B, B→C, C→D}
  Find out the Candidate Key ?
Solution :
  (AE+) :{ABCDE} ⇒ SuperKey
  (A+) : {ABCD}
  (E+) : {E}
  AE : Candidate Key. No subset of its attributes is a key.
Question 5 :
 Let R(ABCDEF) is a relational schema having FDs
  {A→BCDEF, BC→ADEF, B→C, D→E}
  Find out the Candidate Key ?
Solution:
  (A)+: ABCDEF  ⇒ (SuperKey)
  (BC)+ : {BCADEF} ⇒ (SuperKey)
  (B)+ : {BCADEF}
  (C)+ : {C}
  {A, B} ⇐ Candidate Key. No subset of its attributes is a key.
Question 6:
 Given the following set F of functional dependencies for relation schema R = {A, B, C, D, E}.
 {A -> BC, CD -> E, B -> D, E -> A}
 List the candidate keys for R.
Solution :
 (A)+: ABCDE  ⇒ (SuperKey)
 (E)+: EABCD  ⇒ (SuperKey)
 (CD)+: CDEAB  ⇒ (SuperKey)
 (CB)+: CBDEA  ⇒ (SuperKey)
 Any combination of attributes that includes those is a superkey.
 From above , the minimal super keys are  ⇒  A, E, CD and BC.
 Hence, the candidate keys are A, E, CD, BC.
Question 7: 
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.
For ABD, 
(ABD)+ = ABDCE ⇒ Super Key
(A) = {A}
(B) = {B}
(D) = {D}
⇒ ABD is a candidate key. No subset of its attributes is a key.
Question 8 : 
Consider a relation with schema R(A,B,C,D) and FDs {AB -> C, C -> D, D -> A}. What are all candidate keys of R?
(AB)+ : ABCD  ⇒ (SuperKey)
(A)+  : A     ⇒ (Not able to determine all the attributes)
(B)+  : B     ⇒ (not able to determine all the attributes)
(DB)+ : ABCD  ⇒ (SuperKey)
(CB)+ : ABCD  ⇒ (SuperKey)
(D)+  : DA    ⇒ (Not able to determine all the attributes)
(C)+  : CDA   ⇒ (Not able to determine all the attributes)

⇒ By calculating an attribute closure we can see the candidate keys are: AB, BC, and BD.
     

Incoming search terms:

  • numerical on candidate key in dbms
  • dbms question candidate key
  • find candidate keys in abcdefgh
  • gate question on candidates key
  • if A= (ABCDE) all is candidate key then how many no of super keys
  • questions related to keys in dbms
  • gate questions on candidate key
  • number of super keys in relation
  • gate candidate keys questions
  • solve numericals for candiadte super and primery key

This article has 2 comments

  1. Question 5 : Let R(ABCDEF) is a relational schema having FDs {A→BCDEF, BC→ADEF, B→C, D→E} Find out the Candidate Key ?

    for this B alone is a candidate key.
    we get C in B-closure

    Reply

Leave a Reply