MySQL 触发器 语法实例
MySQL触发器语法:
DELIMITER // create trigger [trigger_name] [before/after] [insert/delete/update] on [table_name] for each row begin --doing something like this insert into tab2(tab2_id) values (new.tab1_id); end;// DELIMITER;
实例:
DELIMITER // create trigger t_afterinsert_on_tab1 after insert on tab1 for each row begin insert into tab2(tab2_id) values(new.tab1_id); end;// DELIMITER;
测试通过