I want to populate automaticaly another table when new data is inserted:

For table “source_table” define a after insert trigger

The “NEW” alias contains all inserted fields into table “source_table”;

After “insert” event on table “source_table”, we set the new “id” value into other table “dest_table”;

This is a simple example, it can be used for compute sum, count or similar needs.

Read more about triggers on mysql http://dev.mysql.com/doc/refman/5.0/en/triggers.html

MySQL Trigger – after insert trigger
Tagged on:                         

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.