Difference between Primary Key and Candidate key

Computer EngineeringComputer NetworkMCA

Both Primary Key and Candidate key are used to get records from tables. These keys are also used to create relationship between tables. Primary Key and Candidate key both are used to identify records uniquely in a table.

Following are the important differences between Primary Key and Candidate key.

Sr. No.KeyPrimary KeyCandidate key
1DefinitionPrimary Key is a unique and non-null key which identify a record uniquely in table. A table can have only one primary key.Candidate key is also a unique key to identify a record uniquely in a table but a table can have multiple candidate keys.
2NullPrimary key column value can not be null.Candidate key column can have null value.
3ObjectivePrimary key is most important part of any relation or table.Candidate key signifies as which key can be used as Primary Key.
4UsePrimary Key is a candidate key.Candidate key may or may not be a primary key.
raja
Published on 27-Nov-2019 11:52:37
Advertisements