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:
ALTER TABLE table_name DROP INDEX index_name;
ADVERTISEMENT
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](https://www.tutorialkart.com/wp-content/uploads/2018/12/mysql-show-all-index-from-table.png)
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:
ALTER TABLE students DROP INDEX sectionIndex;
![MySQL DROP COLUMN FROM INDEX](https://www.tutorialkart.com/wp-content/uploads/2018/12/mysql-drop-column-from-index.png)
To confirm if the INDEX has been modified, check the INDEX of students
table.
![MySQL SHOW INDEX FROM TABLE](https://www.tutorialkart.com/wp-content/uploads/2018/12/mysql-show-index-from-table.png)