欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

mysql触发器实例

程序员文章站 2022-06-13 23:47:12
...

DELIMITER // DROP TRIGGER IF EXISTS t_after_insert_test// CREATE TRIGGER t_after_insert_test AFTER INSERT ON test FOR EACH ROW BEGIN IF new.type='1' THEN insert into test_hisy(name, type, create_time, operation) values(new.name, new.type,

DELIMITER //

DROP TRIGGER IF EXISTS t_after_insert_test//

CREATE TRIGGER t_after_insert_test

AFTER INSERT ON test

FOR EACH ROW

BEGIN

IF new.type='1' THEN

insert into test_hisy(name, type, create_time, operation)

values(new.name, new.type, new.create_time, 'insert');

END IF;

END;//