mysql5.6与5.7在关键字上有区别,比如下面这段更新触发器。
create trigger back_tb
before update on tb1 for each row
begin if(NEW.value != OLD.value) then
insert into tb2(id,value,update_time,remark)
select id,value, now() update_time,remark from tb1 where id = Old.id;
end if;
end
和下面这一段
create trigger back_tb
before update on tb1 for each row
begin if(New.value != Old.value) then
insert into tb2(id,value,update_time,remark)
select id,value, now() update_time,remark from tb1 where id = Old.id;
end if;
end
区别就是关键字,在mysql5.7的中,new和old不需要全部大写,一样可以正常执行。在5.6中则需要全部大写,否则无法按照预期取值并执行。