Another feature not present in the SQL standard is the trigger.
Several existing systems have their own non-standard trigger features.
A trigger is a statement that is automatically executed by the
system as a side effect of a modification to the database.
We need to
Specify the conditions under which the trigger is executed.
Specify the actions to be taken by the trigger.
For example, suppose that an overdraft is intended to result in the
account balance being set to zero, and a loan being created for the
overdraft amount.
The trigger actions for tuple with a negative balance are then
Insert a new tuple in the borrow relation with
We need to negate balance to get amount, as balance is negative.
Set to 0.
Note that this is not a good example.
What would happen if the customer already had a loan?
To write this trigger in terms of the original System R trigger:
Page created and maintained by Osmar R. Zaï ane Last Update:
Mon Oct 16 17:01:17 PDT 1995