What is "trigger"

One Trigger (in Portuguese, trigger) database code is a procedure code executed automatically in response to certain events in a given table, or view, in a database. To Trigger is mainly used for maintaining the integrity of information in the database.

For example, when a new record (representing a new worker) is added to the employee table, new records should also be created in the tax, vacation and salary tables.

A generic model of the structure of a Trigger can be seen below:

CREATE TRIGGER nome_trigger ON nome_tabela
FOR INSERT -- ação em que a trigger será executada
AS
BEGIN
    -- comandos a serem executados
END