数据库 - Mysql中,一张表的数据删除的同时,在另一张表中插入的问题。
怪我咯
怪我咯 2017-04-17 14:21:53
0
3
627

问题可能很小白。

想做到如下效果:
有一张表(关联了其他很多表),删除其中数据,同时在另一张表中插入一条同样的数据,以用作备份。。

功能就是这样,备份这条数据可在日后直接恢复到生产环境中。

这时该怎么做呢,有没有什么数据库黑科技可以简单实现呢。。

我删除一条数据在另一个表中插入一条,这种效率吗?有别的方法可以做吗。

谢谢大家。

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(3)
迷茫

Use triggers to implement this, but this is not recommended. You can add a field to the table to mark it as deleted

左手右手慢动作

Have you considered using transaction processing? At the same time, the poster can change his mind and add this record to the backup table first, and then delete this data. Don’t worry, this process must use transactions to maintain event consistency!

左手右手慢动作

Possibly the trigger will have the least impact on the existing system and require the fewest conditions to be met

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!