Home > database >  Mysql data update, insert
Mysql data update, insert

Time:02-11

Search to the operation of a blogger, but need to be the primary key, I although set up in the table id primary key but is automatically incremented, so he wrote when inserting null, if so, how to use this statement?



Address: https://blog.csdn.net/qinyf2015/article/details/80864454? Utm_medium=distribute. Pc_relevant. None - task - blog - BlogCommendFromMachineLearnPai2-5. Control& Depth_1 - utm_source=distribute. Pc_relevant. None - task - blog - BlogCommendFromMachineLearnPai2-5. Control

CodePudding user response:

ON DUPLICATE KEY it is the only judgment is update or insert index, if you insert the only index data in the table with the original conflict will update rather than insert,
Your situation is: the primary key is the, don't specify the primary key, conflicts are not the only key, so will the insert will not update
If it is to test the update situation, can be inserted in the primary key value, and the primary key is worth size is smaller than the since the number now,