Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何比较更新 PHP 和 MySQL 前后的数据?如果我在数据库中添加一些可以更新的数据,有没有办法将新更新的数据与以前的数据进行比较?
是的,这就是触发器的用途。
使用CREATE TRIGGER语法,您可以在 UPDATE 或 INSERT 之前创建触发器
CREATE TRIGGER
CREATE TRIGGER insert_trigger_name BEFORE INSERT ON table
或者
CREATE TRIGGER update_trigger_name BEFORE UPDATE ON table