Solved

Primary key Vs Unique key

Posted on 2004-09-09
2
4,978 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 350 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

690 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