Question
EX 5.5) Write triggers to enforce the referential integrity constraint from section to time slot, on updates to section, and time slot. Note that the
EX 5.5) Write triggers to enforce the referential integrity constraint from section to time slot, on updates to section, and time slot. Note that the ones we wrote in Figure 5.8 do not cover the update operation.
Please provide the answer in terms of the syntax from Database Systems Concepts, 6th Edition, Chapter 5.
Thank you.
The below SQL querry is the only thing provided in the book.
create trigger timeslot check1 after insert on section referencing new row as nrow for each row when (nrow.time slot id not in ( select time slot id from time slot)) /* time slot id not present in time slot */ begin rollback end; create trigger timeslot check2 after delete on timeslot referencing old row as orow for each row when (orow.time slot id not in ( select time slot id from time slot) /* last tuple for time slot id deleted from time slot */ and orow.time slot id in ( select time slot id from section)) /* and time slot id still referenced from section*/ begin rollback end;
Figure 5.8
Step 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