Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a trigger called SALARY_CHANGE_UPD. It is an AFTER UPDATE TRIGGER on the

ID: 3772327 • Letter: C

Question

Create a trigger called SALARY_CHANGE_UPD.  

It is an AFTER UPDATE TRIGGER on the SALARY COLUMN OF THE EMPLOYEE TABLE.   Compare the OLD salary record with the NEW record to check whether they are different.   If they are INSERT a record into the following table, which you will have to create :

CREATE TABLE SALARY_CHANGES(EMPNO NUMBER, NEW_SALARY DECIMAL (10,2), OLD_SALARY DECIMAL(10,2), TIMESTMP DATE);

NOTE : You will need to specify REFERENCE NEW ROW AS NR and REFERENCING OLD ROW AS OR to be able to access the records

Explanation / Answer

CREATE TRIGGER SALARY_CHANGE_UPD FOR Employee
AFTER UPDATE AS
BEGIN
IF (Old.salary <> New.salary) THEN
INSERT INTO SALARY_CHANGES
(EMPNO,NEW_SALARY,OLD_SALARY,TIMESTMP)
VALUES (
OLD.EMPNO,
'NEW.NR',
OLD.OR, 'NOW',USER);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote