Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

image text in transcribed

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Power Bi And Azure Integrating Cloud Analytics For Scalable Solutions

Authors: Kiet Huynh

1st Edition

B0CMHKB85L, 979-8868959943

More Books

Students also viewed these Databases questions