MySQL INDEXES

MySQL INDEXES

 MySQL INDEXES



The MySQL indexes are used to speed up search operations on tables. The indexes are data structure that helps to improve select and search statements.

CREATE INDEX Statement

The CREATE INDEX statement is used for creating new indexes in the MySQL database

Syntax:

CREATE INDEX index_name ON table_name (column1, column2, ....);

Example:
Create an index named idx_empname for column emp_name on Employee tables

CREATE INDEX idx_empname ON Employee (emp_name);

DROP INDEX Statement

DROP INDEX statement is used to delete an existing index from the database.

To remove index idx_empname run the following command on the database.

ALTER TABLE Employees DROP INDEX idx_empname;
Reactions

Post a Comment

0 Comments

close