1

Topic: INSERT a considerable quantity of the data with ignoring of counterparts???

Hello,
Such task, it is necessary:
For example b - is unique

INSERT INTO tbl_name (a, b, c) VALUES (1,2,3);
(4,5,6);
(7,8,9);
(6, 2, 9);
(9, 2, 7);
(5, 2, 4);

Now it will be an error:
[Err] 1062 - Duplicate entry ' 2 ' for key ' b'
And it is added nothing in the table.
And it would be desirable, that it was added (1,2,3), (4,5,6), and remaining it is ignored.
Now I should send two requests on every line.
Thanks.

2

Re: INSERT a considerable quantity of the data with ignoring of counterparts???

Fitter2;

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

If you use the IGNORE modifier, 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.

3

Re: INSERT a considerable quantity of the data with ignoring of counterparts???

Thanks.
Precisely in the purpose.