Finding candidate keys for given relation

mickm picture mickm · Jan 20, 2014 · Viewed 17.2k times · Source
R = (A, B, C, D, E)

The functional dependencies are:

A -> B
ED -> A
BC -> E

It then lists the candidate keys as:

ACD, BCD, CDE

How are these candidate keys derived from the above FDs?

Similarly,

R = (A, B, C, D)

The functional dependencies are:

D -> B 
AB -> D 
AB -> C 
C -> A

It then lists the candidate keys as:

AB, BC, CD, AD

Again, my issue here is that I'm not sure how the candidate keys have been derived from the FDs.

Answer

Peter picture Peter · Jan 20, 2014

This article describes how canditate keys are derived from a given relation.
http://en.wikipedia.org/wiki/Candidate_key.
Also take a look at: candidate keys from functional dependencies
functional-dependencies.
This is also a good one, I think:
http://www.cs.newpaltz.edu/~pletcha/BuildingCandidateKeys.html.
so it's basically:
A => B(first case):
ED => A
BC => E
Because C and D dont depend in any fd, obviously CD is a part of every candiate key.

ACD, BCD, CDE
The second:
D => B
AB => D
AB => C
C=> A

All singles depend in one of the fd, so none of them is included in all candiate keys.
A depends not on D and not on B, neither explicit nor implicit. SO AD and AB is one
candiate key. B doesn't depend on C and A, therefor AB and BC. C doesn't depend on D,
therefor CD.

AB, BC, CD, AD

this one is also usefull: http://csc.lsu.edu/~jianhua/fd_slide2_09.pdf