Home > Database > Mysql Tutorial > body text

When does the trigger execute?

little bottle
Release: 2020-09-16 13:53:37
Original
9335 people have browsed it

A trigger is a special type of stored procedure. Triggers are mainly triggered by events (add, delete, change) and are automatically called and executed. Triggers are often used to enforce business rules. They are high-level constraints that are triggered by events and executed. Stored procedures can be called by the name of the stored procedure.

When does the trigger execute?

Trigger is a method provided by SQL server to programmers and data analysts to ensure data integrity. It is a special method related to table events. The execution of a stored procedure is not called by a program or started manually, but is triggered by events. For example, when a table is operated (insert, delete, update), its execution is activated. Triggers are often used to enforce data integrity constraints and business rules. Triggers can be found in the DBA_TRIGGERS and USER_TRIGGERS data dictionaries. A SQL3 trigger is a statement that can be automatically executed by the system to modify the database.

Trigger timing: Specify the triggering time of the trigger. If it is specified as BEFORE, it means that it is triggered before the DML operation is performed in order to prevent certain error operations from occurring or to implement certain business rules; if it is specified as AFTER, it means that it is triggered after the DML operation is performed in order to record the operation or do certain things. Deal with it afterwards.

Trigger event: causes the trigger to be triggered, that is, DML operation. It can be either a single trigger event or a combination of multiple trigger events (only OR logical combination can be used, and AND logical combination cannot be used).

The above is the detailed content of When does the trigger execute?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template