Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 tableStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started