当前位置:Gxlcms > 数据库问题 > mysql 唯一键

mysql 唯一键

时间:2021-07-01 10:21:17 帮助过:2人阅读

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   | PRI | NULL    | auto_increment |
+------------+------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)


//删除唯一键(该字段依然存在)
alter table table1 drop index name_new;

 

 

 

mysql 唯一键

标签:sql   key   nbsp   sign   ica   sig   bsp   特点   span   

人气教程排行