## How to Find Candidate Key using Functional Dependencies –

In the previous post (How to Find Super Key from Functional Dependencies), we identify all the superkeys using functional dependencies. To identify Candidate Key,

Let R be the relational schema, and X be the set of attributes over R. X^{+} determine all the attributes of R, and therefore X is said to be superkey of R. If there are no superflous attributes in the Super key, then it will be Candidate Key.

**In short, a minimal Super Key is a Candidate Key.**

Example/Question 1 :Let R(ABCDE) is a relational schema with following functional dependencies. AB → C DE → B CD → E

Step 1: Identify the SuperKeys -ACD, ABD, ADE, ABDE, ACDB, ACDE, ACDBE. {From Previous Post Eg.}Step 2: Find minimal super key - Neglecting the last four keys as they can be trimmed down, so, checking the first three keys (ACD, ABD and ADE) For SuperKey : ACD (A)^{+}= {A} - {Not determine all attributes of R} (C)^{+}= {C} - {Not determine all attributes of R} (D)^{+}= {D} - {Not determine all attributes of R} For SuperKey : ABD (A)^{+}= {A} - {Not determine all attributes of R} (B)^{+}= {B} - {Not determine all attributes of R} (D)^{+}= {D} - {Not determine all attributes of R} For SuperKey : ADE (A)^{+}= {A} - {Not determine all attributes of R} (D)^{+}= {D} - {Not determine all attributes of R} (E)^{+}= {E} - {Not determine all attributes of R}Hence none of proper sets of SuperKeys is not able to determine all attributes of R, So ACD, ABD, ADE all are minimal superkeys or candidate keys.

Example/Question 2 :Let R(ABCDE) is a relational schema with following functional dependencies - AB → C C → D B → EA Find Out the Candidate Key ?

Step 1: Identify the super key (AB^{+}) : {ABCDE} ⇒ Superkey (C^{+}) : {CD} ⇒ Not a Superkey (B^{+}) : {BEACD} ⇒ Superkey So, Super Keys will be B, AB, BC, BD, BE, BAC, BAD, BAE, BCD, BCE, BDE, BACD, BACE, BCDE, ABDE, ABCDE Step 2: Find minimal super key - Taking the first one key, as all other keys can be trimmed down - (B^{+}) : {EABCD} {determine all the attributes of R} Since B is a minimal SuperKey ⇒ B is a Candidate Key.So, the Candidate Key of R is - B.

Previous | Home | Next |

Membership Test for Functional Dependency |
How to Find Super Key From Functional Dependencies |

### Incoming search terms:

- how to find candidate key
- how to find candidate keys from functional dependencies
- finding candidate keys from functional dependencies examples
- Candidate key closure
- how to find candidate key and superkey
- how to find candidate key in a relation
- how to find candidate key in question ?