The difference between insert ignore, insert into and replace into

1. insert ignore into:
When inserting data, the database will not check the primary key (primary key) or unique primary key (unique key), such as duplicate data, does not return an error, you can continue to execute.

2. insert into:
When inserting data, the database will check the primary key (primary key) or unique primary key (unique key), if there are duplicates will report an error, unable to insert.

3.replace into:
If there is a record with the same primary key or unique key, delete it first and then insert a new record.

Published 25 original articles · praised 4 · visits 1516

Guess you like

Origin blog.csdn.net/weixin_39025362/article/details/105407112