Open1

mysql tips

きょんきょん

INSERT IGNORE

  • なければinsertを実行, あれば処理をスキップする(auto_incrementは加算される)
  • UNIQUE KEYやPRIMARY KEYの重複エラーをもみ消す
If you use the IGNORE modifier, ignorable errors that occur while executing the INSERT statement are ignored. For example, without IGNORE, a row that duplicates an existing UNIQUE index or PRIMARY KEY value in the table causes a duplicate-key error and the statement is aborted. With IGNORE, the row is discarded and no error occurs. Ignored errors generate warnings instead.

https://dev.mysql.com/doc/refman/8.0/en/insert.html