Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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: Friday, May 15, 2015 4:37 AM
Points: 610, Visits: 2,668
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: Today @ 4:18 PM
Points: 8,439, Visits: 10,152
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: 2 days ago @ 9:21 PM
Points: 227, Visits: 138
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: Today @ 4:33 AM
Points: 1,027, Visits: 1,666
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


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 2:11 AM
Points: 1,269, Visits: 2,713
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


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 2:11 AM
Points: 1,269, Visits: 2,713
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


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 7:42 AM
Points: 14,371, Visits: 12,347
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 LessThanDot.

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

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 8:40 AM
Points: 1,517, Visits: 5,273
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
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 3:35 AM
Points: 980, Visits: 1,705
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


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 12:05 PM
Points: 4,440, Visits: 5,855
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