Thursday, September 22, 2016

Find all the minimal keys of a relation R

Find all the possible minimal keys of a relation / How to find keys of a relation in database management system / Keys or minimal key concepts in dbms / Role of keys or candidate keys in relational database design


2. For a relation R(A, B, C, D, E) with the set of functional dependencies F = {A → B, CD → E, B → D, E → A}, which of the following are the candidate keys (minimal keys) of R?

(a) AB, CD
(b) AC, BC, CD, CE
(c) AC, BC, AEC
(d) A, D, DE


(b) AC, BC, CD, CE

To find a key or minimal key of a relation, we need to find the closure of certain attributes (most of the cases, the attribute(s) on the left hand side of a functional dependency). The closure that includes all the attributes of R in the result is one of the keys (minimal keys/candidate keys). Refer here for a detailed example on how to find the key of a relation. Let us apply the closure finding algorithm on all LHS attributes of the given set of functional dependencies. The result is as follows;
Closure of A, ie., (A)+ = ABD [from A → B and B → D]. ABD is not equal to ABCDE. Hence A is not a candidate key (minimal key).
(B)+ = BD [from B → D]. BD ≠ ABCDE, hence B is not a candidate key.
(E)+ = ABDE [from E → A, A → B, and B → D]. So  E is not a key.
(CD)+ = ABCDE [from CD → E, E → A, and A → B]. As the closure of CD is results in all attributes of R. Hence, CD is one of the candidate keys.

The other candidate keys can be found by combining two or more LHS attributes. In the line,
(AC)+ = ABCDE [from A → B, B → D, and CD → E]
(BC)+ = ABCDE [from B → D, CD → E, and E → A]
(CE)+ = ABCDE [from E → A, A → B, and B → D]

In the option (C), AEC cannot be a minimal key. Because the proper subset {(AE), (AC), (EC), (A), (E), (C)} contains the minimal key. But (AEC) is regarded as the super key as it is a super set of a minimal key.

         Previous Question                                                                                Next Question

1 comment:

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