1. Home
  2. SQL
  3. MySQL Tutorial
  4. MySQL – INDEXES

MySQL – INDEXES

MySQL INDEXES

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

CREATE INDEX Statement

The CREATE INDEX Statement is used for creating new indexes in 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;