To to find the candidate keys:
Form three columns: left, right and middle.
- In the left column, add the attributes which appear only on the left hand side of a FD or do not appear in any FD.
- In the right column, add the attributes which appear only on right hand side of FD.
- In the middle column, add attributes which appear both on right and left hand side of FD.
Explanation:
- Attributes in the left column must be included in every candidate key.
- Attributes in the right column must not be included in any candidate key.
- Attributes in the middle may or may not be included in candidate keys.
In this example, we get E, D in the left column, B, F, G in the middle and A, C, H in the right column.
Then, apply the Closure property:
BED+ = ABCDEFGH
since
BE->GH Given.
BE->FA Decomposition rule and transitivity rule and BE->G and G->FA.
BED->C Given since D->H.
Similarly DEF and DEG can be proved to be candidate keys.
Thus, all three are candidate keys.