HOW TO CREATE INDEX IN SQL

CREATE INDEX in SQL

The CREATE INDEX statement in SQL is used to create indexes in tables. Indexes are used for faster retrieval of records which speed up queries.

Syntax of CREATE INDEX in SQL server. It allow duplicate values

CREATE INDEX <index_name>

ON <table_name> (column_name1..column_nameN);

Syntax of CREATE UNIQUE INDEX in SQL server. It don’t allow duplicate values

CREATE UNIQUE INDEX <index_name>

ON <table_name> (column_name1..column_nameN);

Example of Create Index-

CREATE INDEX ind_name ON Persons (LastName, FirstName);

Syntax of DROP INDEX in SQL server-

DROP INDEX <table_name.index_name>;


Leave a Reply

Your email address will not be published. Required fields are marked *