Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在mysql中更新表中的列时实现触发器_Mysql_Triggers_Sql Update - Fatal编程技术网

在mysql中更新表中的列时实现触发器

在mysql中更新表中的列时实现触发器,mysql,triggers,sql-update,Mysql,Triggers,Sql Update,我有一个名为history的表,表结构如下所示 id dubID country state city total 1 1 India Delhi Delhi 5 2 1 India Karnatka Banglore 100 id dubID country state城市总数 1印度德里德里5 2 1印度卡纳塔卡班格罗100 如果来自任

我有一个名为history的表,表结构如下所示

id dubID country state city total 1 1 India Delhi Delhi 5 2 1 India Karnatka Banglore 100 id dubID country state城市总数 1印度德里德里5 2 1印度卡纳塔卡班格罗100 如果来自任何元组的
total
变为100(来自历史表),我必须在其他表中进行更新

如果可以使用触发器,请提供您的建议


提前谢谢

是的,使用触发器是可能的以下几点是您可以为自己的目的创建触发器的地方。

1.Create trigger <trigger Name> AFTER UPDATE ON history FOR EACH ROW
2.Begin
3.Check if new.total>=100 if not then jump to 5
4.Update your desired table with proper commands
5.END IF
6.END
1.在更新每行的历史记录后创建触发器
2.开始
3.检查new.total是否大于等于100,如果不是,则跳到5
4.使用适当的命令更新所需的表格
5.如果结束
六,完
希望这是你想要的,并且对你有帮助。。 祝你好运