The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+22 votes

Relation $R$ has eight attributes $\text{ABCDEFGH}$. Fields of $R$ contain only atomic values. $F$=

$\text{{CH→G, A→BC, B→CFH, E→A, F→EG}}$ is a set of functional dependencies $(FDs)$ so that $F^+$ is exactly the set of $FDs$ that hold for $R$.

How many candidate keys does the relation $R$ have?

  1. $3$
  2. $4$
  3. $5$
  4. $6$
asked in Databases by Veteran (406k points)
edited by | 4.3k views
How can D be included as a candidate key.  No fd's are mentioned which has D in it.
Should not it be just B, A, E, F
Candidate key means it should functionally determine every other attributes in the relation, Since D is not part of FD's hence it is must to include D in the candidate key , else you cant determine D in any situation as there is no FD defined which contains D.

This might help ....

3 Answers

+18 votes
Best answer

Here, we can see that $D$ is not part of any $FD's$, hence $D$ must be part of the candidate key.

Now $D^{+}$=$\left \{ D \right \}$.

Hence, we have to add A$,B,C,E,F,G,H$ to $D$ and check which of them are Candidate keys of size $2$.

We can proceed as:

AD+= {A,B,C,D,E,F,G,H}

Similarly we see BD+ , ED+ and FD+ also gives us all the attributes. Hence, AD,BD,ED,FD are definitely the candidate keys.

But CD+, GD+ and HD+ doesnnt give all the attributes hence, $CD,GD$ and $HD$ are not candidate keys.

Now we need to check the candidate keys of size $3$. Since $AD, BD, ED, FD$ are all candidate keys hence we can't find candidate keys by adding elements to them as they will give us superkeys as they are already minimal. Hence, we have to proceed with $CD$, $GD$ and $HD.$

 Also, we can't add any of ${A,B,E,F}$ to $CD$, $GD$, $HD$ as they will again give us superset of ${AD,BD,ED,FD}$. 

Hence, we can only add among ${C,G,H}$ to $CD, GD, HD.$

Adding $C$ to $GD$ and $HD$ we get $GCD$, $HCD$. Taking closure and we will see they are not candidate keys.

Adding H to GD we get GHD which is also not a candidate key.(no more options with $3$ attributes possible)

Now we need to check for candidate keys with $4$ attributes. Since, only remaining options are $CGH$ and we have to add $D$ only possible key of size $4$ is $CGHD$ whose closure also doesn't give us all of the attributes in the relation (All possible options covered)

Hence, no of candidate keys are $4$ : AD,BD,ED,FD.

Correct Answer: $B$

answered by Junior (669 points)
edited by

Indranil Maji There is a typo in the last line

Hence no of candidate keys are 4 : AD,BD,ED,HD.

It should be

Hence no of candidate keys are 4 : AD,BD,ED,FD.

Thank You so much , made the changes :)
+21 votes

54) B.

4 candidate keys namely DA,DB,DE,DF.

answered by (257 points)
why so?There is also combination of three attributes which are making ck i.e ABD,BCD,EFD etc.Why not including those?
neha those are super keys that you said
how did u find the candidate keys? please xplain the procedure to solve it.

how can DB and DF be candidate keys ?.. they are not even superkeys. 

in case of DB -   A and E are not reachable.

in case of DF -   nothing is reachable except D and F.. 

Tell me if I am wrong.


F={CH→G, A→BC, B→CFH, E→A, F→EG}

let's check it for DB and DF one by one.

B→CFH,  reachable C ,F and H.

F→EG     reachable E,G

E→A       reachable A

A→BC    reachable B and C

covered- ABCDEFGH.


you can try for DF on your own.


yes, 4 candidate keys are there.
But finding the answer is not as simple as it seems.

After finding it out by taking 2 attributes each, we have to again check with 3 and 4 attributes..... which are not supersets.

Though in this question, they do not make any difference, it is important to check.

+12 votes

Here if we observe all the FD's none of them are determining attribute D 

So the Candidate key must contain D as their attribute 

Futher all the combinations of the attributes with D can be checked and DA,DB,DE,DF are candidate key here and DC.DG,DH does not determine all the attributes therefore they are not CK's 

Totally 4 CK's possible 

answered by Boss (11.1k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,541 questions
54,093 answers
71,001 users