Question: Write a trigger that fires when a row is deleted from the enrolls table. The trigger should record the dropped students scores in a temporary

Write a trigger that fires when a row is deleted from the enrolls table. The trigger should record the dropped students scores in a temporary table, called deleted_scores, and cascade the deletes to ensure that the referential integrity constraints are maintained.

I have this so far but the trigger, but am getting a couple errors:

---------------------------------------------------- CREATE OR REPLACE TRIGGER DELETED_STUDENT_TRIGGER BEFORE DELETE ON ENROLLS1 FOR EACH ROW BEGIN INSERT INTO deleted_students SELECT * FROM ENROLLS1 WHERE ENROLLS1.sid = :old.sid AND ENROLLS1.term = :old.term AND ENROLLS1.linero = :old.linero; DELETE FROM ENROLLS1 WHERE ENROLLS1.sid = :old.sid AND ENROLLS1.term = :old.term AND ENROLLS1.linero = :old.linero; DELETE FROM scores WHERE scores.sid = :old.sid END;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!