'Mysql returning clause equivalent

I am a complete newbie to MySql so please be gentle.

Is there an equivalent of the RETURNING clause in Oracle or the Inserted'/'Deleted tables in SQL Server in MySQL? What I want to do is the following:

  • Delete a set of rows from table A
  • Insert the deleted set of rows into table B.

    Please help!

Thanks



Solution 1:[1]

Why not insert the rows to be deleted from table A in table B and then delete the rows from table A? you can achieve that like this:

insert into tableB select * from tableA where condition;

and then

delete from tableA where condition. 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Euclides Mulémbwè