Advanced Database Management System - Tutorials and Notes: Calculate the key for relation R in DBMS

## Search Engine

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

## Find the candidate keys of a relation, How to find the candidate keys, Which is the key for the given table, concept of candidate key in dbms, candidate key examples

Question:
Consider the relation R = {A, B, C, D, E, F, G, H, I, J} and the set of functional dependencies F as follows;
F = { AB C, BD EF, AD GH, A I, H J}.
Find the key of relation R.

Solution:
We can find keys (candidate keys) for a relation by finding the closure of an/set of attributes. Checking each attribute or all subsets of the given set of attributes for a key is time consuming job. Hence, we may employ some of the following heuristics/assumptions in identifying the keys;

• We may start checking all the left hand side attributes of any/all of the given set of functional dependencies. We can start with single LHS attributes.
• If we find the closure of an attribute and that attribute is the candidate key then any superset cannot be the candidate key. For example, if A is a candidate key, then AB is not a candidate key but a super key.

Hint: The left hand side only attribute will definitely be the key or part of the key.

***************

Go to - 1NF,    2NF,    3NF,    BCNF