How can we remove multicolumn UNIQUE indexes?


Multicolumn UNIQUE indexes can also be removed in the same as we remove UNIQUE constraint from the table.

Example

In this example, with the following query we have removed the multicolumn UNIQUE indexes on table ‘employee’ −

mysql> DROP index id_fname_lname on employee;
Query OK, 0 rows affected (0.30 sec)
Records: 0 Duplicates: 0 Warnings: 0

The removal of UNIQUE indexes can be observed from the result sets of the following query −

mysql> show index from employee;
Empty set (0.00 sec)

mysql> describe employee;
+------------+-------------+------+-----+---------+-------+
| Field      | Type        | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| empid      | int(11)     | YES  |     | NULL    |       |
| first_name | varchar(20) | YES  |     | NULL    |       |
| last_name  | varchar(20) | YES  |     | NULL    |       |
+------------+-------------+------+-----+---------+-------+
3 rows in set (0.08 sec)

Updated on: 19-Jun-2020

63 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements