Find Candidate Keys by looking to Functional Dependencies

database-designnormalization

I'm studying Database Design and I am in trouble with the Candidate Keys and the Functional Dependencies.

I have these Functional Dependences:

B → CEF

G → AD

B → DG

GA → B

My idea is: Since GA is the only one attribute that is not functionally determined by anyone, then, by using Armstrong's Axioms, I see that GA determines all attribute of the Schema S.

So there is only one Candidate Key: GA.

Am I right? Thanks in advance.

Best Answer

The relation with the above functional dependencies has two different candidate keys: B and G.

You can verify this if you compute the closure of both to see if it contains all the attributes:

B+ = B
B+ = BCEF (by using the dependency B → CEF)
B+ = BCEFDG (by using B → DG)
B+ = BCEFDGA (by using G → AD), all the attributes, B is a candidate key

While for G:

G+ = G
G+ = GAD (by using G → AD)
G+ = GADB (by using GA → B)
G+ = GADBCEF (by using B → CEF), all the attributes, G is a candidate key

No other set of attributes is a candidate key, since the only other attribute on the left side is A, but GA is determined by G, so it can be eliminated from that dependency.

Actually a canonical cover of the original set of dependencies is:

{ B → C
  B → E
  B → F
  B → G
  G → A
  G → D
  G → B }