question

Radhika0613 avatar image
Radhika0613 asked

How to find candidate keys from a set of super keys?

Explain with an example How to find candidate keys from a set of super keys?

primary-key
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Pranjali13 avatar image
Pranjali13 answered

From all the super keys available, the candidate key is the one whose proper subset is not a super key. Let’s see it with an example.

given set of super key is:

ABC-> ABC
AB -> C
BC -> A
A -> BC

Given ABC key, we’re saying if we find its proper subset i.e. {A, B, C, AB, AC, BC} and any of them can be a key then ABC can’t become a candidate key.

Given ABC key, we’re saying if we find its proper subset i.e. {A, B, C, AB, AC, BC} and any of them can be a key then ABC can’t become a candidate key.

AB, which comes from the proper subset of ABC, is also a key. Therefore, ABC is not a candidate key.

Note: If x is a proper subset of y then x must NOT have one element that is included in y. Example,

X = {1,2,3} Y = {1,2,3,4}

Here, we can say X is a proper subset of Y since X doesn’t have 4 in it.

Similarly, AB is also not a candidate key because we have got A in its proper subset which can be used as a key. Therefore, at last, we found that A is the ONLY candidate key available for the above schema.

To get a detail information regarding different types of keys in dbms check out: https://www.scaler.com/topics/keys-in-dbms/

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.