How can we remove multicolumn UNIQUE indexes?

MySQLMySQLi Database

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)
raja
Published on 16-Feb-2018 18:00:39
Advertisements