两种方法
方法一:牛客编译器能正常通过
CREATE TRIGGER audit_log after insert
ON employees_test
FOR EACH ROW
BEGIN
INSERT INTO audit VALUES(NEW.ID, NEW.NAME);
END;
方法二:牛客编译器不能正常通过,本地MySQL能正常通过
CREATE TRIGGER audit_log after insert
ON employees_test
FOR EACH ROW
BEGIN
INSERT INTO audit
SET action = 'insert',
EMP_no = NEW.ID,
NAME = NEW.NAME,
changedat = NOW();
END;