SQL Drop Table Indexes

Removing Indexes

Remove indexes with the DROP INDEX statement.

This is the most widely used method to remove an index.
Syntax:
MySQL, SQL server:
DROP INDEX index_name on table_name;
Example:
DROP INDEX ISNB_AUTHOR_IND on Bookstore;
Syntax:
Oracle, PostgreSQL:
DROP INDEX index_name ; /* does not need the table name */
DROP INDEX IF EXISTS index_name ; /* ONLY PostgreSQL*/
Example:
DROP INDEX ISNB_AUTHOR_IND;

Removing Indexes with the ALTER TABLE statement

In some RDBMS you can remove indexes with the ALTER TABLE statement.
Drop index for in a table:
MySQL:
ALTER TABLE table_name
  DROP INDEX constraint_name,
  DROP INDEX constraint_name, ....;
Example:
ALTER TABLE BOOKSTORE
  DROP INDEX SHORTDESC_IND,
  DROP INDEX AUTHOR_IND;  

© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.