I want to populate automaticaly another table when new data is inserted: For table “source_table” define a after insert trigger
1 2 3 4 5 6 |
DELIMITER $$ CREATE TRIGGER `source_table_AINS` AFTER INSERT ON `source_table` FOR EACH ROW -- Edit trigger body code below this line. Do not edit lines above this one begin insert into dest_table set source_id=NEW.id; end |
The “NEW” alias contains all inserted fields into table “source_table”; After “insert” event on table “source_table”, we set the