0% found this document useful (0 votes)
10 views2 pages

Keys

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Keys

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Since all the answers are missing physical representation and

some of them are incomplete. So here is the difference by


graphical representation

Explanation
Super Key
Super key is a set of one or more than one keys that can be used to identify a
record uniquely in a table.

Example : Primary key, Unique key, Alternate key are subset of Super Keys.
Candidate Key
A Candidate Key is a set of one or more fields/columns that can identify a
record uniquely in a table. There can be multiple Candidate Keys in one table.
Each Candidate Key can work as Primary Key.

Example: In above diagram ID, RollNo and EnrollNo are Candidate Keys
since all these three fields can be work as Primary Key.
Primary Key
Primary key is a set of one or more fields/columns of a table that uniquely
identify a record in database table. It can not accept null, duplicate values. Only
one Candidate Key can be Primary Key.

Alternate key
A Alternate key is a key that can be work as a primary key. Basically it is a
candidate key that currently is not primary key.
Example: In above diagram RollNo and EnrollNo becomes Alternate Keys
when we define ID as Primary Key.
Composite/Compound Key
Composite Key is a combination of more than one fields/columns of a table. It
can be a Candidate key, Primary key.

Unique Key
Uniquekey is a set of one or more fields/columns of a table that uniquely identify
a record in database table. It is like Primary key but it can accept only one null
value and it can not have duplicate values. For more help refer the
article Difference between primary key and unique key.
Foreign Key
Foreign Key is a field in database table that is Primary key in another table. It
can accept multiple null, duplicate values. For more help refer the
article Difference between primary key and foreign key.
Example : We can have a DeptID column in the Employee table which is
pointing to DeptID column in a department table where it a primary key.

You might also like