Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

pdf icons

Dropping MySQL Index

Test whether the index was created on Table:

The SHOW CREATE TABLE command:
To test whether an index has been bound to the clientmaster table, execute the SHOW CREATE TABLE statement as shown in Diagram 1:

The following is the syntax for verifying whether an index was created on column(s) of a table
Syntax:
<System prompt> SHOW CREATE TABLE <Table Name> \G;

Example:
mysql> SHOW CREATE TABLE clientmaster \G;

diagram1.png
Diagram 1

In Diagram 1, KEY ‘index_id’ (‘clientid’) indicates that the index is bound on the column ‘clientid’.

Drop A MySQL Index:

MySQL allows dropping existing INDEXES. For this MySQL provides the ALTER TABLE and DROP statements. You can use the ALTER TABLE statement to drop "normal" or "unique" indexes.

To drop an index bound to a table column the base table must modified by using the ALTER TABLE statement as shown in Diagram 2.

Syntax:
<System prompt> ALTER TABLE <Table Name> DROP INDEX <Index Name>;

Example:
mysql> ALTER TABLE clientmaster DROP INDEX index_id;

diagram2.png
Diagram 2

In Diagram 2, KEY ‘index_id’ (‘clientid’) does not appear which indicates that the index is successfully dropped from the column ‘clientid’.

OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download
LinkShare_180x150
Artisteer - DNN Skin Generator
Tapestry Theme - A Tumblog-Style Theme for Wordpress