We have considered a Student and Course Relational Model for our Reference Examples.

Example Student Course Relational Model

Candidate Key:

The minimal set of attribute which can uniquely identify a tuple is known as candidate key. For Example, STUD_NO in STUDENT relation.

Note -

In Sql Server a unique constraint that has a nullable column, allows the value ' null' in that column only once. That's why STUD_PHONE attribute as candidate here, but can not be 'null' values in primary key attribute.

Super Key:

The set of attributes that can uniquely identify a tuple is known as Super Key. For Example, STUD_NO, (STUD_NO, STUD_NAME), etc.

Primary Key:

There can be more than one candidate key in relation out of which one can be chosen as the primary key.

For Example, STUD_NO, as well as STUD_PHONE both, are candidate keys for relation STUDENT but STUD_NO can be chosen as the primary key (only one out of many candidate keys).

Alternate Key:

The candidate key other than the primary key is called an alternate key. For Example, STUD_NO, as well as STUD_PHONE both, are candidate keys for relation STUDENT but STUD_PHONE will be alternate key (only one out of many candidate keys).

Foreign Key: