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, E) with FD's AB C, CD E, C A, C D, D B.
Determine all the keys of relation R. Do not list superkeys that are not a candidate key.

Solution:
Key 1:

From AB C and C D, we obtained AB D. (as per Transitivity rule)
From AB C and AB D, we obtained AB CD. (as per Union rule)
From AB CD and CD E, we obtained AB E. (as per Transitivity rule)

From above points, we would know that the attributes AB together can identify all the other attributes of R uniquely. Hence, AB is one of the keys.

Key 2:

From C A and C B, we obtained C AB. (as per Union rule)

From AB, we can obtain the rest of the attributes. (See the discussion in Key 1 above). Hence, C is one of the keys.

Key 3:

From D B, we can get AD AB. (as per Augmentation rule)

From AB, we can obtain the rest of the attributes. (See the discussion in Key 1 above). Hence AD is one of the keys.

The keys are AB, AD, and C.

1. Hello Admin, Why can't CD be a key as well? We know that , with reflexivity rule, CD -> E: CDE, and with C ->AD, and D->B. Isn't CD be a key?

1. Hi Sherman, CD is a super key because we found that C is a key. CD is not a candidate key.
Candidate key is a minimal super key for which no proper subset is a key. Proper subset for CD is {C} and {D}. But already C is a key. Hence, CD cannot be a key (candidate).

## 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...

data recovery