Before inserting data into table i need to check against duplicate records and report list of those records. Query should not insert anything while there is at least one duplicate.
Number of records to insert: ~1000
Rows in table: ~1.000.000
Table:
CREATE TABLE `test` (
`A` varchar(19) NOT NULL,
`B` varchar(9) NOT NULL,
KEY `A` (`A`),
KEY `B` (`B`)
) ENGINE=InnoDB;
I need to check for both columns:
What is the efficient way of doing this.
Thanks in advance.
P.S. consider using php and mysql