Sample Header Ad - 728x90

Non-clustered Primary Key and Clustered Index

2 votes
2 answers
2584 views
It is my understanding that in SQL Server, you can have a Primary Key that is non-clustered, and have another index that is the clustered one. To me, this seems the same as just having a Primary Key, and an extra UNIQUE key. So I have two questions: 1) if a Primary Key is non-clustered, does it store all the columns with it? Or only the Primary Key columns and the columns referencing the clustered index? 2) I've just read that if the PK isn't the clustered index, then the clustered index does NOT have to be UNIQUE (but it's highly encouraged). Does this mean then that the table could be "randomly sorted" on the rows with the same key?
Asked by Nuno (829 rep)
May 16, 2022, 10:07 AM
Last activity: May 17, 2022, 11:23 AM