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

Before Candidate Key Vs. For superkey and prime attributes vs. non-prime attributes, we must know about functional dependency and closure methods.

**Candidate Key VS Super Key**

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

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

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

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

We can say that the candidate key is a minimal super-key.

**Prime Vs. Non-Prime Attributes**

Those attributes that appear in the candidate key set are Prime attributes.

Those attributes that do not occur in ANY candidate key are called non-prime attributes.

**Example: 01**

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

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

Keep in mind that the combination of the candidate key with some other attributes of a given relation can also determine all the attributes of a relation, but it is considered as a 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 a given relation are only A. Because only a single attribute, “A,” is a part of the candidate key set.
- Non-Prime attributes of the given relation are B,C, and D. Because B,C, and D attributes are not part of the 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 a given relation are part of the candidate key set.
- Non-Prime attributes of given relation = NULL. It is because there are attributes of the given relation which is not part of the candidate key set.