[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Primary key Vs Unique key

Posted on 2004-09-09
2
Medium Priority
?
4,984 Views
Last Modified: 2008-01-09
Is there any point in declaring a primary key if I already have a unique clustered index on the primary key field(s)?
0
Comment
Question by:billy21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
hkamal earned 1400 total points
ID: 12018118
Yes, all tables should have a primary key
This just formalises your structure for inter-entity relationships
0
 
LVL 15

Expert Comment

by:jdlambert1
ID: 12018444
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question