开发者

Can one create a table based on other tables that updates as they do with MySQL? [closed]

开发者 https://www.devze.com 2023-03-16 05:11 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetori开发者_如何学运维cal andcannot be reasonably answered in its current for
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetori开发者_如何学运维cal and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I want to create a table that populates off of other tables and automatically updates as they are updated. How do I do that?


http://dev.mysql.com/doc/refman/5.0/en/triggers.html

Triggers can be run on inserts, updates, and deletes, so you can attach whichever ones meet your need.

Inside your trigger, you can run additional SQL statements, or work with the row that is being inserted or updated.

You'll find that triggers are very powerful, but some people don't like them because they are somewhat hidden, and people often don't check for their existence. I personally think that's a bogus argument against them since it leads to worse hacks, but be aware that you need to document them so people don't forget they are there.

0

精彩评论

暂无评论...
验证码 换一张
取 消