在 PhpMyadmin 中创建触发器?

发布于 2024-09-26 03:01:45 字数 149 浏览 0 评论 0原文

我正在使用两张桌子。

用户表包含名字和姓氏字段,而 contactinfo 是另一个包含名为“Name”的字段和用户表 ID 的表。

我想在用户表名字或姓氏更新时触发一个触发器。我想将此联系人信息的名称更改为他们在用户表中更改的名称。可以通过触发器吗?

I am using two tables.

User table contains the firstname and lastname field and contactinfo is another table contain the field called 'Name' with usertable Id.

I want to make a trigger whenever the User tables firstname or lastname is updated. I want change this contactinfo's Name to whatever they changed in the User table. Is it possible through trigger?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝颜夕 2024-10-03 03:01:45

CREATE TRIGGER 的一般语法是:

CREATE TRIGGER trigger_name trigger_time trigger_event ON tbl_name 
FOR EACH ROW trigger_statement

看一下 http://www. Roseindia.net/mysql/mysql5/triggers.shtmlhttp://dev.mysql.com/doc/refman/5.1/en/create-trigger.html

The general syntax of CREATE TRIGGER is :

CREATE TRIGGER trigger_name trigger_time trigger_event ON tbl_name 
FOR EACH ROW trigger_statement

Take a look at examples from http://www.roseindia.net/mysql/mysql5/triggers.shtml and http://dev.mysql.com/doc/refman/5.1/en/create-trigger.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文