# After Delete Trigger CREATE TABLE Salaries ( employeeNumber INT PRIMARY KEY, salary DECIMAL(10,2) NOT NULL DEFAULT 0 ); INSERT INTO Salaries(employeeNumber,salary) VALUES (1002,5000), (1056,7000), (1076,8000); CREATE TABLE SalaryBudgets( total DECIMAL(15,2) NOT NULL ); INSERT INTO SalaryBudgets(total) SELECT SUM(salary) FROM Salaries; DELIMITER // CREATE TRIGGER after_salaries_delete AFTER DELETE ON Salaries FOR EACH ROW BEGIN UPDATE SalaryBudgets SET total = total - old.salary; END // DELIMITER ; DELETE FROM Salaries WHERE employeeNumber = 1002;