If I have a Parent and Child table in MySQL related by a foreign key, is it possible using a SQL statement to move certain rows from Parent and the related rows from Child into archive tables (e.g. Parent_Archive and Child_Archive) in an atomic manner?
Share
Use transactions – their whole purpose is to make the series of SQL statements atomic.
For example (NOT very optimized – can be improved with temp table):