Amit Vasava
Amit Vasava

Reputation: 1

databases on (primary key & candidat key)

If a table has only one key then we can say that it is primary key as well as candidate key ??

Upvotes: 0

Views: 34

Answers (2)

nish
nish

Reputation: 1221

The answer to your question is YES. For more information, refer the below definition and link:

Candidate Key – A Candidate Key can be any column or a combination of columns that can qualify as unique key in the database. There can be multiple Candidate Keys in one table. Each Candidate Key can qualify as Primary Key.

Primary Key – A Primary Key is a column or a combination of columns that uniquely identify a record. Only one Candidate Key can be Primary Key.

https://blog.sqlauthority.com/2009/10/22/sql-server-difference-candidate-keys-primary-key-simple-words/

Upvotes: 2

xCloudx8
xCloudx8

Reputation: 721

Candidate Key – A Candidate Key can be any column or a combination of columns that can qualify as unique key in database. There can be multiple Candidate Keys in one table. Each Candidate Key can qualify as Primary Key.

Primary Key – A Primary Key is a column or a combination of columns that uniquely identify a record. Only one Candidate Key can be Primary Key.

If a table has only one key it can be a primary or candidate depending on your idea.

More Here

Upvotes: 0

Related Questions