Wednesday, July 12, 2017

Simple solution for finding the key of a relation

Find the key of a relation, How to find the candidate key of a given table. Given the set of functional dependencies, how to find the key of a relational table.

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:
From the F it is very clear that the attributes A, B and D are the only attributes on LHS of any FDs. That is, none of these attributes are found in the right hand side (RHS) of any of the given FDs. Hence, we can start with finding the closure of (ABD).

LHS
Result
Description
(ABD)+
= ABCD from AB → C (By reflexivity)
= ABCDGH from AD → GH. (By reflexivity)
= ABCDGHI from A → I. (By reflexivity)
= ABCDGHIJ from H → J. (By transitivity)
= ABCDEFGHIJ from BD → EF. (By reflexivity)
(ABD)+ = R.
Hence, (ABD) is the candidate key.

The proper subset of (ABD) is (AB), (AD), (BD), (A), (B), (D). None of the elements in the proper subset of (ABD) forms a candidate key. Hence, we declare that the key for R is (ABD).

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

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






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

All time most popular contents

data recovery