时间:2021-07-01 10:21:17 帮助过:2人阅读
使用mysql trigger实现
mysql> show triggers\G$ *************************** 1. row *************************** Trigger: t12 Event: UPDATE Table: t3 Statement: begin update t4 set tid = new.id where tid = old.id; end Timing: AFTER Created: NULL sql_mode: NO_ENGINE_SUBSTITUTION Definer: root@localhost character_set_client: gbk collation_connection: gbk_chinese_ci Database Collation: utf8_general_ci *************************** 2. row *************************** Trigger: t11 Event: DELETE Table: t3 Statement: begin update t4 set tid = 0 where tid = old.id; end Timing: AFTER Created: NULL sql_mode: NO_ENGINE_SUBSTITUTION Definer: root@localhost character_set_client: gbk collation_connection: gbk_chinese_ci Database Collation: utf8_general_ci 2 rows in set (0.02 sec)
MySQL外键约束On Delete、On Update
标签:innodb ble mode weight tab nbsp char trigger new