在mysql中一个表已经有了主键,我还想增加一个主键,该怎么操作啊?
mysql>describett0;+-------+------------+------+-----+---------+-------+|Field|Type|Nu...
mysql> describe tt0;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| id | int(11) | NO | PRI | 0 | |
| idd | int(11) | NO | PRI | 0 | |
| zifu | varchar(5) | YES | | NULL | |
+-------+------------+------+-----+---------+-------+
3 rows in set (0.01 sec)
mysql> alter table tt0 add primary key (zifu);
ERROR 1068 (42000): Multiple primary key defined 展开
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| id | int(11) | NO | PRI | 0 | |
| idd | int(11) | NO | PRI | 0 | |
| zifu | varchar(5) | YES | | NULL | |
+-------+------------+------+-----+---------+-------+
3 rows in set (0.01 sec)
mysql> alter table tt0 add primary key (zifu);
ERROR 1068 (42000): Multiple primary key defined 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |