I yesterday made a mystake and deleted some rows in a mysql table (luck that I've set LIMIT 2000).
Now I want to use a backup to insert only the deleted rows again. I got:
tb_production:
id (primary key) col1 col2
--------------------------------
1 data data
2 data data
6 data data
9 data data
As you see, there are the rows missing. Now I want to insert the missing rows from the backup table into the (above) production table:
tb_backup:
id (primary key) col1 col2
--------------------------------
1 data data
2 data data
3 data data
4 data data
5 data data
6 data data
7 data data
8 data data
9 data data
I've found a good answer here on stackoverflow (How can I merge two MySQL tables?), given answer:
INSERT IGNORE INTO table_1 SELECT * FROM table_2;
I don't want to do another mistake again, so I ask you:
How to merge the rows from the backup table into the production table, without overwriting existing rows in the production table and with a LIMIT 2000 again?