top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Difference between PRIMARY KEY, UNIQUE KEY, CANDIDATE KEY? Where I have to use this?

+1 vote
521 views

In my table I have three unique column this can be referred by other table.
Which key I have to use for this.

posted Apr 30, 2015 by Nagaraj

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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.

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.

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.

answer Nov 4, 2015 by Shivaranjini
...