Javatpoint Logo
Javatpoint Logo

SQLite Trigger: AFTER UPDATE

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.

Sqlite Trigger after update 1

Now update the old record as following:

Sqlite Trigger after update 2

See the result:

Sqlite Trigger after update 3

See the trigger:

Sqlite Trigger after update 4

SQLite Trigger: BEFORE UPDATE

If you want to create the trigger before updating the data:

Sqlite Trigger after update 5

See the triggers:

Sqlite Trigger after update 6





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA