Mysql触发器

10. January 2017 DataBase 0

delimiter // 定义触发器
create trigger Yn_trigger
after insert on user for each row
begin
update data set name=’赛亚人’ where id=1;
end //

show triggers查看触发器
insert into user(id,name,age) values(101,’ss’,100); 插入数据引发触发器
select * from user; 查看结果

drop trigger in_trigger删除触发器

before insert,

after insert

before update

after update

执行更新操作,会执行before insert,before update,after update

插入新纪录只会执行 before insert,after insert


Leave a Reply

Your email address will not be published. Required fields are marked *