Can we create clustered index on non primary key column
Answer Posted / vamsi krishna
Create table Testing(testingID int,testingdesc varchar(20))
Note: I am not defining TestingID as primaryKey
create clustered index IX_TestingID on Testing(TestingID)
-- This will allow u to insert duplicate values to the
column that has clustered index created.
Instead run the below command to create unique Clustered
Index
create unique clustered index IX_TestingID on Testing
(TestingID)
-- The above statment will not allow u to add duplicate
records.
For your better conformation insert some records into the
tabel and execute a select statement having the clustered
index column in the where clause and check the execution
plan. You can see Index Seek.
Conclusion : Clustered index can be created on non
primaryKey column
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How many full-text indexes can a table have?
How do I know if localdb is running?
What is the difference between system objects and user objects?
What is pivot and unpivot?
What is the difference between function and stored procedure in sql server?
what is unique and xaml nonclustered index
How to handle error or exception in sql?
What are 3 ways to get a count of the number of records in a table?
You want to implement the one-to-many relationship while designing tables. How would you do it?
can we have a nested transaction? : Sql server database administration
Explain about extended stored procedure?
how to restart sql server in single user mode? How to start sql server in minimal configuration mode? : Sql server database administration
what are acid properties? : Sql server database administration
How to transfer data from a cursor to variables with a "fetch" statement?
Define msdb database?