What is Nonclustered Index?
Non-Clustered Index,
1. Non-clustered indexes can be used more than one time per table.
2. Non-clustered indexes store logical structure but clustered indexes store in physical order.
3. Faster for insert and update operations than a clustered index.
4. Improve the performance when select data with index fields.
5. Non-clustered indexes are stored separately.
6. We can add only 249 non-clustered indexes for a table.
7. Non-clustered indexes made on the any key but clustered indexes only on primary keys.
How to create Nonclustered Index?
-- CREATE NONCLUSTERED INDEX
CREATE NONCLUSTERED INDEX Indexname_EmployeeON Employee
(
[EmpName] ASC --OR DESC,
[EmpDepartment]ASC --OR DESC
)
-- OR
-- CREATE NONCLUSTERED INDEX
CREATE NONCLUSTERED INDEX [Indexname_Anil1]ON [dbo].[Emply]
(
[EmpName] ASC,-- OR DESC,
[EmpDepartment]ASC-- OR DESC
)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF,
IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = OFF)
ON [PRIMARY]
I hope you enjoying with this post! Thank you very much!