Skip to content

TRIGGER

CREATE TRIGGER employees_salary_update
BEFORE UPDATE ON employees
FOR EACH ROW
BEGIN
SET NEW.salary = NEW.salary + 1000;
END;
Query OK, 0 rows affected (0.00 sec)

In the provided example, a trigger named employees_salary_update is created. This trigger operates before an update event on the employees table. For each row being updated, the trigger will add 1000 to the new value of the salary column. The output simply confirms that the trigger was created successfully, with no rows affected since the trigger took no immediate action.