##### Basics of Candidate Key and counting

We already know the formal definition of candidate key let's talk some more.

1. Given that a set S = {}

Then the maximum number of candidate key possible is :

**Example 1:-**

find the Candidate Keys.

Solution:

First, find out which of the attributes are not derived by any other attributes

So are the one. So they must be present in CK.

So only are the candidate keys because they are deriving all the attributes.

**Finding the number of Super keys:-**

If a set has **n** elements and one of the element is already known to be a candidate key then any superset of the candidate key is Superkey. We know this stuff. Remaining **n-1 **keys have two choices either they can be the part of superkey or not.

**Example:-**

**1. let **

and it is already known that is then the number of superkeys is:-

the total number of attributes is 10 and out of which 3 attributes formed candidate key then the remaining 7, has two choices: either they want to be the part of superkey or not.

So 2 choices ................7 times

So total number of superkeys = =

**2.**

find the number of super keys.

Solution:-

First, find the number of candidate keys:-

is not derived by anyone So it must be the part of a candidate key.

So only two candidate keys:

**Number of superkeys = **

number of superkeys when is taken as candidate key **+ **number of superkeys when is taken as the candidate key **- **number of superkeys when BOTH are taken as the candidate key

=