创建触发器MySQL以更新员工表中的薪资

创建触发器MySQL以更新员工表中的薪资,mysql,plsql,Mysql,Plsql,如何创建触发器MySQL来更新员工表中的薪资并将薪资列中的旧值替换为旧的薪资列?请参见: create trigger salary_trigger before update on employee for each row begin if new.salary != old.salary then set new.old_salary = old.salary end if; end;

如何创建触发器MySQL来更新员工表中的薪资并将薪资列中的旧值替换为旧的薪资列?

请参见:

create trigger salary_trigger
    before update on employee
    for each row begin
        if new.salary != old.salary then
            set new.old_salary = old.salary
        end if;
    end;