语法结构类似
DELIMITER $$;
DROP TRIGGER `log`$$
CREATE TRIGGER `log` BEFORE/AFTER INSERT/UPDATE/DELETE on `user`
FOR EACH ROW BEGIN
END$$
DELIMITER ;$$
具体例子:
删除:
DELIMITER $$;
DROP TRIGGER `log`$$
CREATE TRIGGER `log` AFTER DELETE on `user`
FOR EACH ROW BEGIN
insert into userLog (useroid,userAccount,pwd,userType,companyInfoOid,personalInfoOid,
status,regDate,email) values (old.oid,old.userAccount,old.pwd,old.userType,old.companyInfoOid,old.personalInfoOid,old.status,old.regDate,old.email);
END$$
DELIMITER ;$$
如果是修改/的话,old应该是new