MySQL – Drop Column

In one of previous MySQL Tutorials, we have learned to add a column to the INDEX. In this tutorial, we shall learn to DROP a COLUMN from INDEX in MySQL.

Syntax – Drop Column

To drop a column from the INDEX, syntax of the SQL Query is:

</>
Copy
ALTER TABLE table_name DROP INDEX index_name;

Example 1 – DROP a column from INDEX

We can add one or more columns as a single entry to the INDEX using an index name.

For example, the INDEX of students table is

MySQL show all index of a table

Values in boxes are the index names and those underlined are column names in the respective index.

Now we shall delete the index, sectionIndex, from the INDEX of students table.

Following is the query to delete sectionIndex from the INDEX:

</>
Copy
ALTER TABLE students DROP INDEX sectionIndex;
MySQL DROP COLUMN FROM INDEX

To confirm if the INDEX has been modified, check the INDEX of students table.

MySQL SHOW INDEX FROM TABLE