SQL DROP INDEX Keyword
The SQL DROP INDEX keyword is used to delete a index on a table. Indexes are useful to retrieve data from the database more quickly and speeds up the search queries. Indexes are not visible to the end users. Along with this, updating a table with indexes takes more time as compared to a table without any indexes because indexes are updated. Therefore it is advised to create indexes only on frequently searched columns.
Syntax
The syntax for using DROP INDEX statement is given below:
/* MyAccess */ DROP INDEX index_name ON table_name; /* MySQL */ ALTER TABLE table_name DROP INDEX index_name; /* SQL Server */ DROP INDEX table_name.index_name; /*Oracle */ DROP INDEX index_name;
SQL DROP INDEX keyword Examples
To create a index on multiple columns (Name and EmpID) of a table (Employee), the SQL code is given below:
CREATE INDEX UID ON Employee (Name, EmpID);
To delete the index named UID of the Employee table, the SQL code is given below:
/* MyAccess */ DROP INDEX UID ON Employee; /* MySQL */ ALTER TABLE Employee DROP INDEX UID; /* SQL Server */ DROP INDEX Employee.UID; /*Oracle */ DROP INDEX UID;
❮ SQL Keywords