1.创建触发器
create trigger trigger_name trigger_time trigger_event on table_name for each row
begin
trigger_stmt
end
- trigger_time:before或者是after
- trigger_event:insert、update和delete
use oa; --create table trigg select * from students where 1=2; delimiter // create trigger cus_trigger before insert on students for each row begin insert into trigg values(new.id,new.tname); end // delimiter ; insert into students (tname)values(‘hehe‘);
2.删除触发器
drop trigger trigger_name;