Index

  • Clustered Index
  • Non-Clustered Index

View indexes

SELECT *
FROM sys.indexes

Clustered Index

Clustered Index
-- creating a clustered index of RoleId column of Roles table --
CREATE CLUSTERED INDEX idx_RoleId_Roles ON Roles(RoleId)
DROP INDEX idx_RoleId_Roles ON Roles
ALTER TABLE Roles DROP CONSTRAINT pk_RoleId 

Non-Clustered Index

Non-Clustered Index
CREATE NONCLUSTERED INDEX nidx_RoleName_Roles ON Roles(RoleName)

--

--

Software Developer | Web Developer | Database Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store