If you use the IGNORE keyword, 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 still is not inserted, but no error occurs. Ignored errors may generate warnings instead, although duplicate-key errors do not.
发布评论
评论(1)
这题目问的也太模糊了, 没法做准确的回答.
我假设你想要的是 insert ignore:
用insert ignore, 假如主键或 唯一索引 已存在, 则不会插入, 也不会报错.