Link to home
Start Free TrialLog in
Avatar of milani_lucie
milani_lucieFlag for United States of America

asked on

Primary Key - Clustered Index - SQL Server

Hi,

I thought that when you create a primary key, clustered index is automatically created. Am i correct or wrong ? But here is what i have got:

When you create a PRIMARY KEY constraint, a unique clustered index on the column or columns is automatically created if a clustered index on the table does not already exist and you do not specify a unique nonclustered index.

Please explain me on detail manner whether i am correct or wrong. Provide simple examples to understand it better.

I did not follow this statement: and you do not specify a unique nonclustered index => Please explain in detail with example.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ThakurVinay
ThakurVinay

When you create a primary key unique cluster index automatically creates but it is not necessory you can create a primary key with out unique cluster index.

if you try to create primary key with GUI you will understand it better.

HTH
Vinay
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial