Monday, 8 July 2019

Clustered and Non-Clustered Indexes in SQL?

Clustered and Non-Clustered Indexes in SQL?

Clustered:  The index defines the order in which data is physically stored in a table.
1. Only one clustered index per table.
2. Primary key constraint automatically creates a clustered index
2. Order in which data is physically stored in a table

To retrieves the indexes:
EXECUTE sp_helpindex Appointment

Non-Clustered: 

This allows for more than one non-clustered index per table.

CREATE NONCLUSTERED INDEX Appointment_PatientId
ON Appointment(PatientId ASC)

No comments:

Post a Comment