添加了主键约束,但是id有了默认值0,添加第二条记录的时候就会出现这样的错误,怎么回事啊
mysql> show columns from user2;
+----------+----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+----------------------+------+-----+---------+-------+
| id | smallint(5) unsigned | NO | PRI | 0 | |
| username | varchar(20) | NO | | NULL | |
| pid | smallint(5) unsigned | YES | MUL | NULL | |
+----------+----------------------+------+-----+---------+-------+
3 rows in set (0.09 sec)
mysql> insert user2(username,pid) value('Rose',2);
ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'