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
Get step-by-step solutions from verified subject matter experts
