Wednesday, 3 February 2016

Normalization solved exercise to find key

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.


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


To find the key of a relation, 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 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 and D together, i.e., (BD)+ = ABCD. All the attributes can be determined. Hence, BD is a key (a composite key).
 The key for R is (BD).

Go back to Normalization - solved exercises page.

1 comment:

SQL exercises for beginners one

SQL Exercises for Beginners / Simple SQL Exercises with Answers / Solved SQL exercises / SQL solved exercises with simple conditions / So...