in Databases
409 views
2 votes
2 votes
Consider a relation R having seven attributes ABCDEFG. Fields of R contain only atomic values.
FDs = {CD → G, A → BC, B → CF, E → A, F → EG, G → D} is set of functional dependencies. So, how many candidates key does the relation R have?
in Databases
409 views

1 Answer

5 votes
5 votes
Best answer

We have a relation R(A, B, C, D, E, F, G) & Functional Dependencies :

CD → G

A → BC

B → CF

E → A

F → EG

G → D

 

Now, let’s try by picking 1 element at a time :

$A^{+}$ = {A, B, C, D, E, F, G} = R 

$B^{+}$ = {A, B, C, D, E, F, G} = R 

$C^{+}$ = {C} $\neq$ R 

$D^{+}$ = {D} $\neq$ R 

$E^{+}$ = {A, B, C, D, E, F, G} = R 

$F^{+}$ = {A, B, C, D, E, F, G} = R 

$G^{+}$ = {G, D} $\neq$ R 

 

Since, C, D & G fails in forming candidate key. Let’s try different combinations by picking any 2 of them :

$CD^{+}$ = {C, D, G} $\neq$ R 

$CG^{+}$ = {C, D, G} $\neq$ R 

$DG^{+}$ = {D, G} $\neq$ R

$\therefore$  All these 2 pair combination again fail.

At last, $CDG^{+}$ = {C, D, G} $\neq$ R.

 

So, A, B, E & F forms candidate key.

Total 4 Candidate Keys.

selected by