SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5-47' for key 'PRIMARY'
2017-11-03 10:13
1131 查看
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘5-47’ for key ‘PRIMARY’
在数据表插入数据时出现这个错误,原因是:表中可能出现两个主键,所以会报这个错误
解决方法:将主键设置去掉就可以解决了
注释: 主键在一个表中只有一个,但主键有两种,单一的和复合主键,可以设置为多个字段为主键,即复合主键。想设复合主键要先建立约束,外键可以有多个。
相关文章推荐
- ERROR 1062 (23000): Duplicate entry '5' for key 'PRIMARY'
- Integrity constraint violation: 1062 Duplicata du champ '0' pour la clef 'PRIMARY'解决方法
- 判断mysql是否插入成功时要注意,否则会出现mysql Integrity constraint violation: 1062 Duplicate entry.....这种问题
- mysql数据库:ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'
- Magento报错之SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry for key 1
- txt导入Mysql:ERROR 1062(23000):Duplicate entry '0' for key 'PRIMARY'
- #1062 - Duplicate entry '0' for key 'PRIMARY'—— mysql的小问题
- mysql主从库同步错误:1062 Error 'Duplicate entry '1438019' for key 'PRIMARY'' on query
- Last_Errno: 1062,Last_Error: Error 'Duplicate entry '...' for key 'PRIMARY'' on query. 的详细分析过程
- ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
- ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
- MySQL ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
- Yii报错:SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in order clause is ambiguous
- MySQLIntegrityConstraintViolationException: Duplicate entry '***' for key 'PRIMARY'
- [Err] 1062 - Duplicate entry '0' for key 'PRIMARY'
- 利用navicat向mysql数据库导入数据时出现1062 - Duplicate entry '0' for key 'PRIMARY'错误的解决办法
- MySql出现ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
- SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'customer' cannot be null
- MySQLIntegrityConstraintViolationException: Column 'ID' in where clause is ambiguous
- ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'