Hi friends,
I want to know What's the difference between a primary key and a clustered index?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anil KumarPosted Jun 4, 2012, 7:01 AM
And may not have any index also. !!!
Or can have both or any one.
Check indexes on a table using this -
EXEC sp_helpindex
Anil KumarPosted Jun 4, 2012, 6:26 AM
A primary key with non-clustered index may gives good performance over clustered primary key in some scenario. You may have a clustered indexing on other column (not with primary) which is mostly using for range search and your primary key with non-clustered index. All depends upon the requirements!!!
Clustered Index: For clustered index, column doesn't need to be unique. Please re-read last line. Clustered index column may contain duplicate values, Null values!!!. There is no problem at all. This is not possible with Primary key. A primary key can't have null or duplicate values.
SenthilkumarPosted Jun 4, 2012, 5:58 AM
When you create the primary key on table then, it will create the clustered index. You can have only one clustered index per table.
Since you can have only one primary key. At the same time you can create the clustered index by CREATE CLUSTERED INDEX statement.
When you have clustered index on the table when every you do DML operation, it will do sorting automatically based on clustered index column.
The clustered node will have the value.