What is difference between Clustered & Non-Clustered in SQL.
What is the difference between Clustered and Non-Clustered Indexes in SQL Server? Please explain to me in a simple way with example. I Request you don't send me other links. If you want to answer, please explain in your words and in a simpler way.
Thank you

Amit MohantyPosted Mar 1, 2020, 11:00 PM
A clustered index defines the order in which data is physically stored in a table. Table data can be sorted in the only way, therefore, there can be only one clustered index per table. In SQL Server, the primary key constraint automatically creates a clustered index on that particular column.
A non-clustered index doesn’t sort the physical data inside the table. In fact, a non-clustered index is stored in one place and table data is stored in another place.
When we create a query against a column on which the index is created, the database will first go to the index and look for the address of the corresponding row in the table. Then it will go to that row address and fetch other column values.
The syntax for creating a non-clustered or clustered index is similar. However, in the case of a non-clustered index keyword, “NONCLUSTERED” is used instead of “CLUSTERED”.
Syntex: CREATE NONCLUSTERED INDEX IX_tblEmployee_EmpName ON tblEmployee(EmpName ASC)
There can be only one clustered index per table. However, you can create multiple non-clustered indexes on a single table.
Clustered indexes are faster than non-clustered indexes since they don’t involve any extra lookup step.
Clustered indexes only sort tables. Therefore, they do not consume extra storage. Non-clustered indexes are stored in a separate place from the actual table claiming more storage space.
Rajeev KumarPosted Mar 6, 2023, 1:40 PM
Ajay GohilPosted Mar 1, 2020, 10:44 PM
Ravi PatelPosted Mar 1, 2020, 6:09 AM
Rajanikant HawaldarPosted Mar 1, 2020, 2:41 AM