What is Trigger in SQL?

Forums SQLWhat is Trigger in SQL?
Staff asked 1 month ago

What is Trigger in SQL?

Answers (1)

Add Answer
Staff answered 1 month ago

A trigger is one kind of stored procedure in the database that is automatically called/invokes whenever a special event in the database occurs.

For EX, a trigger can be invoked when certain table columns are being updated or deleted.

There are two types of triggers:

  1. DDL Trigger (Data Definition Language)
  2. DML Trigger (Data Manipulation Language)

The DDL triggers are invoked to DDL (Data Definition Language) command that starts with Create, Alter, and Drops, For EX- Create_table, Create_view, drop_table, Drop_view, and Alter_table.

The DML triggers are invoked to DML (Data Manipulation Language) command that starts with Insert, Update and Delete. For EX- insert_table, Update_view and Delete_table.

For more details with example, you can refer to the below article.
How To Use Triggers In SQL

Subscribe

Select Categories