Please visit, subscribe and share 10 Minutes Lectures in Computer Science

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:

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.

********

How to find the key of a relation during normalization process

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...