Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Is a Primary Key an index? Expand / Collapse
Author
Message
Posted Tuesday, July 15, 2014 9:16 PM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Monday, August 15, 2016 10:16 AM
Points: 646, Visits: 2,864
Comments posted to this topic are about the item Is a Primary Key an index?


Best wishes,

Phil Factor
Simple Talk
Post #1592889
Posted Tuesday, July 15, 2014 9:17 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Yesterday @ 7:39 AM
Points: 9,626, Visits: 11,654
Irritating because over-pedantic. Good question nevertheless.

Tom
Post #1592890
Posted Tuesday, July 15, 2014 10:59 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, May 27, 2016 8:41 PM
Points: 243, Visits: 209
Question didn't really make an adequate distinction between the logical and the physical:
Does the logical definition of a Primary Key imply the presence of an index? No
In SQL Server, does the presence of a Primary Key imply some kind of index is also present? Yes
Post #1592900
Posted Tuesday, July 15, 2014 11:11 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, August 3, 2016 4:31 AM
Points: 1,262, Visits: 1,833
This is my understanding. primary key is a constraint not an index, but it creates an index automatically by default, but primary key is called a constraint not an index though. so I got it correct (though I had to think little bit)

Good question
Post #1592904
Posted Wednesday, July 16, 2014 12:23 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 6:32 AM
Points: 1,555, Visits: 2,928
Thank you for the post, simply good one. (for me the question was simple enough)

ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
Post #1592918
Posted Wednesday, July 16, 2014 12:23 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 6:32 AM
Points: 1,555, Visits: 2,928
pmadhavapeddi22 (7/15/2014)
This is my understanding. primary key is a constraint not an index, but it creates an index automatically by default, but primary key is called a constraint not an index though. so I got it correct (though I had to think little bit)

Good question


+1


ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
Post #1592919
Posted Wednesday, July 16, 2014 12:52 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: 2 days ago @ 1:36 AM
Points: 15,289, Visits: 13,074
I remembered that it is sometimes called a "primary key constraint", so the question was easy enough.
Still I expect some flaming in this topic




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1592927
Posted Wednesday, July 16, 2014 12:54 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 4:38 AM
Points: 2,180, Visits: 8,428
I got it wrong because I misinterpreted this line:

When you specify a PRIMARY KEY constraint for a table, the Database Engine enforces data uniqueness by creating a unique index for the primary key columns.


It creates an index but doesn't use the PRIMARY KEY as that index. Annoying, but my fault.



On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
—Charles Babbage, Passages from the Life of a Philosopher

How to post a question to get the most help
Post #1592928
Posted Wednesday, July 16, 2014 1:42 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 12:06 AM
Points: 1,335, Visits: 2,517
Koen Verbeeck (7/16/2014)
I remembered that it is sometimes called a "primary key constraint", so the question was easy enough.
Still I expect some flaming in this topic


+1, Nice question
Post #1592936
Posted Wednesday, July 16, 2014 2:04 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:38 AM
Points: 5,211, Visits: 6,930
TomThomson (7/15/2014)
Irritating because over-pedantic. Good question nevertheless.

+1


____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1592939
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse