NONCLUSTERED
NONCLUSTERED is a type of index in SQL that does not rearrange the physical order of the data in the table. Instead, it creates a separate object within the database containing a sorted list of references to the data, giving the database engine the ability to locate data quickly without having to search every row in a table. One table can have multiple nonclustered indexes.
Example
Output
Explanation
The above SQL command creates a nonclustered index, idx_employee_lastname
, on the LastName
column of the Employee
table. This index helps in swiftly accessing the rows in the Employee
table based on the LastName
field. The confirmation message “Command(s) completed successfully.” implies that the index has been created successfuly.