KnowledgeBoat Logo

Informatics Practices

Define the term Primary Key in a database. Explain how it is different from a Candidate Key.

Relational Database

2 Likes

Answer

A primary key is a set of one or more attributes/fields that can uniquely identify tuples/rows within the relation (table). It must contain unique values and cannot be null.

A candidate key, on the other hand, refers to all the attributes in a relation that are candidates or are capable of becoming a primary key. A table can have multiple candidate keys, but only one of them is chosen as the primary key.

Answered By

3 Likes


Related Questions