Shailesh Jaiswal Shailesh Jaiswal - 1 year ago 80
SQL Question

What is the difference between candidate key and composite key?

I am reading about candidate keys and composite keys. I came to know that


  • a candidate key can qualify as a primary key and it can be a single column or combination of columns

  • and a composite key is also a combination of columns.



For composite key I have referred this link

how do I make a composite key with SQL Server Management Studio?

Thus when both the candidate key and composite key are a combination of columns, they can qualify as a primary key. Then what is the exact difference ? Can you please explain with examples ?

Answer Source

As I know candidate key is a unique key that can be used as a primary key. but not necessarily used as one.

Composite key is a key of two or more attributes that uniquely identifies the row.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download