Opening book details…
Can I read MySQL Trigger Creation and Management on EtoBox?
MySQL Trigger Creation and Management by sarthaksainia12 is a document available to read on EtoBox.
What is MySQL Trigger Creation and Management about?
Here is the trigger to update the total salary in SalaryBudgets after a row is deleted from Salaries: DELIMITER $$ CREATE TRIGGER update_salary_budget AFTER DELETE ON Salaries FOR EACH ROW BEGIN UPDATE SalaryBudgets SET total = total - OLD.salary; END$$ DELIMITER ; To test it: DELETE FROM Salaries WHERE employeeNumber = 1002; SELECT * FROM SalaryBudgets; This trigger uses the OLD row to access the salary of the deleted row and subtracts it from the total in SalaryBudgets.
- Author
- sarthaksainia12
- Language
- EN