Home /
Expert Answers /
Computer Science /
can-someone-help-me-i-need-sql-management-triggers-for-employ-table-to-update-after-insert-dele-pa151
(Solved): can someone help me? I need SQL management (triggers) for employ table to (update,after insert ,dele ...
can someone help me? I need SQL management (triggers) for employ table to (update,after insert ,delete) salary column. for 100 salary column. this codes are working but ?t doesn't change any thing.
???????
CREATE TRIGGER update_salary_after_insert AFTER INSERT ON employ FOR EACH ROW BEGIN UPDATE employ SET salary \( = \) salary \( +100 \) WHERE id = NEW.id; END; This trigger will update the salary column with an additional 100 for each new row that is inserted into the employ table. AFTER UPDATE [CREATE TRIGGER update_salary_after_update AFTER UPDATE ON employ FOR EACH ROW BEGIN UPDATE employ SET salary \( = \) salary \( +200 \) WHERE id = NEW.id; END; This trigger will update the salary column with an additional 200 for each row that is updated in the employ tab
AFTER DELETE CREATE TRIGGER update_salary_after_delete AFTER DELETE ON employ FOR EACH ROW BEGIN UPDATE employ SET salary \( = \) salary \( -300 \) WHERE id = OLD.id; END; This trigger will update the salary column by subtracting 300 for each row that is deleted from the employ table.