The problem is the key duplication encountered in inserting data table.
solution:
1. Using ignore, if there are duplicate values in the inserted record, the record row with duplicate values will be ignored, and the insertion of other rows will not be affected.
INSERT IGNORE INTO Table_name(…..) VALUES(1,1),(2,2),(3,3);
2. Use replace to delete the duplicate record row in the table before inserting when the inserted record encounters primary key or unique duplicate
REPLACE INTO Table_name() VALUES(1,1),(2,2),(3,3)
3. Using values after on duplicate key update refers to the value of the inserted record, while not using values refers to the value of the table itself. The record of the subsequent update is the ID of the duplicate primary key or unique key where.
NSERT TO Table_name() VALUES(1,1),(1,2) ON DUPLICATE KEY UPDATE NAME1=NAME1+1;
Download: https://blog.csdn.net/zhangyr_student/article/details/80119238
Read More:
- Txt import MySQL: error 1062 (23000): duplicate entry ‘0’ for key ‘primary’
- Solution of duplicate entry ‘value’ for key ‘field name’ in MySQL
- Duplicate entry ‘787192513’ for key ‘primary’
- [reprint and save] MySQL does not set the primary key and uses the self growing ID method
- mysql Error Code: 1022. Can’t write; duplicate key in table `xxx`
- [Oracle] when inserting data, “ora-00001: unique constraint” appears
- E11000 duplicate key error collection in mongodb
- Solution to error 1452: cannot add or update a child row: a foreign key constraint failures in MySQL
- Lambda set to map duplicate key error solution
- Endnote inserting documents causes word to crash! ! Solution
- [MySQL] [serialize] [error record] after modifying data, no data will be returned (in fact, MySQL does not support it)
- Solution of MySQL data garbled problem
- Dbsql occurs when configuring SAP ATC during SCI check_DUPLICATE_KEY_ERROR
- MySQL error 1451 23000 foreign key exception handling
- Mongoose Error: e11000 duplicate key error collection, code: 11000
- pymongo.errors.DuplicateKeyError: E11000 duplicate key error collection: anjuke.ershoufang index
- sqoop-import ERROR tool.ImportTool: Import failed: No primary key could be found for table user_info
- Python implements inserting content in the specified position of text
- MySQL creates tables and sets auto increment of primary keys
- The MySQL load data command parses and handles error 29 (errCode: 13) errors (in the Ubuntu environment)