Use mysql’s `replace into` safely!
Introduction MySQL’s popular replace into destination_database.destination_table (fields) select fields from source_database.source_table; query can be very dangerous if not used properly. Illustration Say, you have schema’s like: create table source_table ( field1 bigint not null, field2 int not null, field3 varchar(50) default '0' not null, primary key (field1, field2) ); create table destination_table ( field1 bigint not null, field2 int not null, field3 varchar(50) default '0' not null, primary key (field1, field2) ); Now, if you want to replace some data from source table to the destination table, you can do something like:...