##
**Set of solved exercises in
Normalization / Normalization Solved Examples / How to find candidate keys, and
primary keys in database? / Sets of examples to find the keys of a tables /
Process of Key finding in a database – Examples.**

__Question:__
Consider a relation R (A, B, C, D) with FD's B → C, D → A. Determine all the keys of
relation R.

__Solution:__**, we need to find the closure of attributes. If any attribute’s or set of attributes’ closure gives all the attributes of the relation, then we would say that attribute/set of attributes as the key for that relation.**

*To find the key of a relation*
To simplify this task or to avoid
finding closure of all attributes, let us do find the closure for left hand
side (LHS) attributes of the functional dependencies.

For the given question,
attributes B and D are the LHS attributes.

- The closure of B, (B)
^{+}= BC from ≠ ABCD. Hence B is not a key. [Refer, How tofind closure/how to find key, purpose of finding attribute closure]

- The closure of D, (D)
^{+}= DA ≠ ABCD. Hence D is not a key. [Refer, How to find closure/how to find key, purpose of finding attribute closure]

- The closure of B and D together,
i.e., (BD)
^{+}= ABCD. All the attributes can be determined. Hence, BD is a key (a composite key).

Go back to Normalization - solved exercises page.

## No comments:

## Post a Comment