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.
精彩评论