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
What is inline variable assignment?
How do you make a trace?
What is the difference between commit and rollback?
What is the difference between a local and a global temporary table?
What is a view in sql?
what is difference between NULL and ISNULL in SQL Server 2008?
Explain full-text indexing?
What is scrollable cursor?
What are temporal tables in sql server 2016?
In which format does an image save in SQL Server database ?
What are ddl (data definition language) statements for tables in ms sql server?
What is a unique index?
Tell me what is the significance of null value and why should we avoid permitting null values?
Explain nested join?
What are number line correlation administrators will use while working with a subquery?