Home  >  Article  >  Database  >  How to create triggers in phpmyadmin

How to create triggers in phpmyadmin

王林
王林Original
2019-12-28 09:31:154775browse

How to create triggers in phpmyadmin

Type the phpmyadmin address in the browser, enter the administrator username and password, and enter the phpmyadmin management page.

How to create triggers in phpmyadmin

#After entering, select the database where the operation object is located. Click [SQL] directly in the menu of the database overview and type the code to create the trigger. Click [Execute].

How to create triggers in phpmyadmin

After creation, click on the data table corresponding to the trigger condition in the trigger to view its [Structure]. Click [Details...] at the bottom of the structure.

How to create triggers in phpmyadmin

Scroll to the bottom of the interface, and the trigger you just created will be in the bottom right corner. Can be edited or deleted. Multiple triggers can be created, but they cannot have the same name. Generally, it is written in the trigger that if the name is the same, the creation will be cancelled.

How to create triggers in phpmyadmin

After clicking the edit button, modify the trigger. Let's take a look at the syntax of triggers:

create trigger <触发器名称>
{ before | after}
{insert | update | delete}
on <表名>
for each row
<触发器SQL语句>

"Stories" are all in the .

How to create triggers in phpmyadmin

create trigger : Create a new trigger and specify the name of the trigger.

{ before | after}: Used to specify whether to trigger before the insert, update or delete statement is executed or after the statement is executed.

on

: used to specify the table name that responds to the trigger.

For each row: The execution interval of the trigger, for each row notifies the trigger to perform an action every other row, rather than once for the entire table.

: The SQL statement to be executed by the trigger. If the trigger wants to execute multiple SQL statements, multiple statements must be placed in the begin...end block.

How to create triggers in phpmyadmin

Creation completed!

Recommended related articles and tutorials: phpmyadmin tutorial

The above is the detailed content of How to create triggers in phpmyadmin. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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