• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4988
  • Last Modified:

Primary key Vs Unique key

Is there any point in declaring a primary key if I already have a unique clustered index on the primary key field(s)?
0
billy21
Asked:
billy21
1 Solution
 
hkamalCommented:
Yes, all tables should have a primary key
This just formalises your structure for inter-entity relationships
0
 
jdlambert1Commented:
I agree with hkamal that all tables should have a primary key. I've heard many reasons why people didn't define them for some tables, but I don't buy the arguments. It's a best practice and a good habit. If you define a primary key on a table and it actually never "needed", no harm is done. If you don't define a primary key because you're "sure" it will never be needed, but you turn out to be wrong, great harm can be done. And I've seen a great many databases that were in extremely bad shape because of failures including lack of primary keys where people didn't think they were needed.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now