문제

What is the differences between candidate key and primary key?

도움이 되었습니까?

해결책

I think this post does a pretty good job of explaining the difference.

To summarize:

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.

A table can have multiple Candidate Keys that are unique as single column or combined multiple columns to the table. They are all candidates for Primary Key.

다른 팁

Candidate keys can take null values whereas primary keys can never be null. That is also one of the significant differences.

Candidate Key – A Candidate Key can be any column or a combination of columns that can qualify as a unique key in the database. There can be multiple Candidate Keys in one table. Each Candidate Key can qualify as a 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.

Candidate keys can take null values whereas primary keys can never be null. That is also one of the significant differences.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 dba.stackexchange
scroll top