Unique key features:
a unique key in a table can have more.
2 , allows the unique key field data is NULL, NULL may have a plurality of (NULL does not participate in the comparison)
// a table allows multiple unique key, the only key allows empty, not empty in case must be unique
// set a unique key field
mysql> alter table `table1` add unique ( `name_new`); Query OK, 0 rows affected (0.02 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> desc table1; +------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+------------------+------+-----+---------+----------------+ | name_new | char(32) | YES | UNI | NULL | | | transactor | varchar(10) | NO | | NULL | | | PID | int ( 10 ) unsigned | NO | the PRI | NULL | AUTO_INCREMENT | + ----------------------- ----------- + + ------ + ----- + ------- + ---------------- + --------- . 3 rows in the SET ( 0.00 sec) // delete a unique key (the field is still there) the ALTER drop the Table table1 index name_new;