It specifies how to create trigger after update the data. Suppose, we have two tables COMPANY and AUDIT, here we want to keep audit trial for every record being updated in COMPANY table.
COMPANY table:
Create a new table named AUDIT where log messages will be inserted whenever there is an updation in COMPANY table.
AUDIT table:
CREATE trigger after update:
Use the following syntax to create a trigger named "after_up" on COMPANY table after update operation.
Now update the old record as following:
See the result:
See the trigger:
SQLite Trigger: BEFORE UPDATE
If you want to create the trigger before updating the data:
See the triggers:
No comments:
Post a Comment