Before V/s After Triggers In Database, Diffrence Between Before And After Triggers, Why We Do Triggers

Before V/s after triggers
When defining a trigger it is necessary to specify the trigger timing, i.e. specifying when the triggering action is to be executed in relation to the triggering statement.
Before and after apply to both row and the statement triggers.
Before triggers execute the trigger action before the triggering statement. These types of triggers are commonly used in the following situation:
Before triggers are used when the trigger action should determine whether or not the triggering statement should be allowed to complete. By using a before trigger, one can eliminate unnecessary processing of the triggering statement.
Before triggers are used to drive specific column values before completing a triggering INSERT or UPDATE statement.
AFTER trigger executes the trigger action after the triggering statement is executed. These types of triggers are commonly used in the following situation:
AFTER triggers are used when you want the triggering statement to complete before executing the trigger action.
If a before trigger is already present, an AFTER trigger can perform different actions on the same triggering statement.
Why We Do Triggers:

0 comments:
Post a Comment
Thanks For Your Comment. We Get Back To You As Soon As Possible.