Multiple statements

Report a typo

Let's create a trigger that performs multiple statements.

This new trigger will check before updating that the new salary is not greater than the old salary. And it will be necessary to activate it before the trigger not_cut_salary.

If your new salary is higher, then you need to make an entry about it in the manager table.

Let's sort it in the right order.

Put the items in the correct order
IF NEW.salary > OLD.salary THEN
CREATE TRIGGER not_rise_salary
BEFORE UPDATE ON employee
FOR EACH ROW PRECEDES not_cut_salary
INSERT INTO manager VALUES (OLD.id, OLD.name, NEW.salary);
SET NEW.salary = OLD.salary;
END;
END IF;
BEGIN
___

Create a free account to access the full topic