How can I check that the table contains only unique identification card (column name Should I index the Use an option Only the first 4 rows above will be inserted, the last 3 rows are not inserted because they have duplicate keys. id ) , And if no one does anything else, else enter the record?
id column and set it as a unique / primary key?
INSERT IGNORE . As the name suggests, the rows in it must be included, and it will do nothing with two rows.
make table table 1 (`id` is not an integer; primary elementary key;` fu 'varchar (20)); (1, 'A'), (2, 'A'), (3, 'A'), (4, 'A'), (1, '1' one) (1, 'A');
INSERT IGNORE requires that you have a primary key or unique index. More info
INSERT IGNORE (as well as other ways to handle duplicates):
No comments:
Post a Comment