Browse By

Answers to Candidate Key hard questions

Hi,
Thanks for visiting my blog.

Here are the answers for the two hard finding candidate keys examples:

*Answer
————-
1. ABCDEF
DF -> C
BC -> F
E -> A
ABC -> E

Steps:
1. Find the attributes that are not on both side
> –
2. Find the attributes that are only on the right side
> –
3. Find the attributes that are only on the left side
> BD
4. Find the attributes that on both sides
> ACEF

5. Find the closures of core attributes in step 3
> The closures of BD is only BD, it’s not all attributes

6. Find the closures of core attributes + one exterior attributes at a time (attributes on step 4).
> BDA – BDA
> BDC – BDCF
> BDE – BDEA
> BDF – BDFC
> none of the closures is the whole relation

7. Find the closures of core attributes + two exterior attributes at a time
> BDAC – BDACEF (the closure is the whole relation)
> BDAE – BDAE
> BDAF – BDAFCE (the closures is the whole relation)
> BDCE – BDCEAF (the closures is the whole relation)
> BDCF – BDCF
> BDEF – BDEFCA (the closures is the whole relation)

8. So the candidate keys are BDAC, BDAF, BDCE, and BDEF.

2.
ABCDE
A -> BC
CD -> E
B -> D
E -> A

Steps:
1. Find the attributes that are not on both side
> –
2. Find the attributes that are only on the right side
> –
3. Find the attributes that are only on the left side
> –
4. Find the attributes that on both sides
> ABCDE

*This is a special case, there is no core attributes, all attributes are on both sides, so all attributes are exterior. In this case we will try find the closures of one attribute at a time.

A – ABCDE (the closures is the whole relation)
B – BD
C – C
D – D
E – EABCD (the closures is the whole relation)

So A and E are candidate keys. Let’s try more combination without A and E.

BC – BCDEA (the closures is the whole relation)
BD – BD
CD – CDEAB (the closures is the whole relation)

So BC and CD are also candidate keys. So the candidate keys are A, E, BC, and CD.

Best regards,

djito

Leave a Reply

Your email address will not be published. Required fields are marked *