**Candidate Vs. Super Key AND Prime vs. Non-Prime Attributes**

Before to Candidate Key Vs. Super Key and prime attributes vs. non-prime attributes, we must know about functional dependency, closure Method.

**Candidate Key VS Super Key**

A super-key is a set of attributes of a relation which are used to

- uniquely identify a tuple
- determines all the attributes of given relation.

. A candidate key is a minimal set of attributes necessary to

- uniquely identify a tuple.
- determines all the attributes of given relation.

We can say, candidate key is a minimal super-key.

**Prime Vs. Non-Prime Attributes**

Those attributes which are appears in candidate key set are Prime attributes.

Those attributes that does not occur in ANY candidate key is called a non-prime attribute.

**Example: 01**

Suppose a relation (R)= {A, B, C, D} and FD = {A→B, B→C, C→D}. Then

As we see in previous lecture only the closure of attribute “A” can determine the all attributes of given relation. So, attribute “A” can be used as Candidate key

Keep in mind, the combination of candidate key with some other attributes of given relation can also determine all the attributes of a relation but it consider as super key not a candidate key.

So,

- Candidate Key of given relation = {A}
- Super Key of given Relation = {AB, AC, AD, ABC, ACD, ABCD}
- Prime attributes of given relation is only A. Because only a single attribute “A” is a part of candidate key set.
- Non-Prime attributes of given relation are B,C and D. Because B,C and D attribute are not the part of candidate key set.

**Example: 02**

Suppose a Relation R= {A, B, C, D} and FD = {A→B, B→C, C→D, D→A}

Then

- Candidate Key of given relation = {A, B, C,D}
- Super Key of given Relation = {AB, BC, CD, ABC, BCD………..}
- Prime attributes of given relation = {A, B, C,D} . It is because all attributes of given relation are the part of candidate key set.
- Non-Prime attributes of given relation = NULL. It is because there is non- attributes of given relation which is not the part of candidate key set.