Procedure to determine Candidate key using attribute closure

Candidate Key:

An attribute or the combination of attributes is called candidate key if and only if:

  • They derive all the attributes of the relation.
  • They are the minimal subset of the super key.

Note:

  1. Candidate keys can be either simple or composite.
  2. Minimal subset is not with respect to the no of attributes however it always refer to the minimal level of subset which does not have any proper subsets that derives all the attributes of the relation.
  3. A relation can have more than one candidate key

we can determine candidate key using below steps:

  1. Find out attribute closure for each of the determinant. How to find out attribute closure using given set of functional dependencies.
  2. Check which determinant closure derive all the attributes of the relation.
  3. Declare all the determinant whose closure set contains all the attributes, as candidate key
  4. In case none of the determinant of the given functional dependencies derives all the attributes, then we shall choose the best closure based on more no of attribute derived and then combine the missing attribute to the best closure and make sure it is the minimal subset before it gets declared as candidate key.

Example:

R(A. B, C, D) {A->C, B->D}

A= {A,C}

B+= {B,D}

as none of the determinant’s closure set derives all the attributes, hence we can combine both AB and get the closure

AB+= {A,C,B,D}.

ABderives all the attribute hence AB is the candidate key.

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.