当前位置:网站首页>[MySQL learning notes 29] trigger
[MySQL learning notes 29] trigger
2022-07-06 07:19:00 【yqs_ two hundred and eighty-one million eight hundred and seven】
establish
CREATE TRIGGER trigger_name
BEFORE/AFTER INSERT/UPDATE/DELETE
ON tb_name FOR EACH ROW – Line level triggers
BEGIN
trigger_statement;
END;
see
SHOW TRIGGERS;
Delete
DROP TRIGGER [schema_name.]trigger_name; -- Is not specified schema_name The default is the current database
Case study
create trigger tb_user_insert_trigger after insert on tb_user for each row
begin
insert into tb_logs(id,operation,operate_time,operate_id,operate_params)
values(null,'insert',now(),new.id,concat(' The inserted data content is :',new.content));
end;
create trigger tb_user_insert_trigger after update on tb_user for each row
begin
insert into tb_logs(id,operation,operate_time,operate_id,operate_params)
values(null,'update',now(),new.id,concat(' Data before updating :',old.content));
end;
边栏推荐
- 配置树莓派接入网络
- Week6 weekly report
- 3. Business and load balancing of high architecture
- Win10 64 bit Mitsubishi PLC software appears oleaut32 DLL access denied
- leetcode841. 钥匙和房间(中等)
- Setting and using richview trvstyle template style
- Top test sharing: if you want to change careers, you must consider these issues clearly!
- TypeScript 函数定义
- LeetCode 78:子集
- MPLS experiment
猜你喜欢

C - Inheritance - polymorphism - virtual function member (lower)

The first Baidu push plug-in of dream weaving fully automatic collection Optimization SEO collection module

Uncaught typeerror: cannot red properties of undefined (reading 'beforeeach') solution

【mysql学习笔记30】锁(非教程)

The author is dead? AI is conquering mankind with art

Bugku CTF daily question: do you want seeds? Blackmailed

CDN acceleration and cracking anti-theft chain function

win10 64位装三菱PLC软件出现oleaut32.dll拒绝访问

NiO programming introduction

数字IC设计笔试题汇总(一)
随机推荐
Top test sharing: if you want to change careers, you must consider these issues clearly!
leetcode59. 螺旋矩阵 II(中等)
Depth residual network
多线程和并发编程(二)
【线上问题处理】因代码造成mysql表死锁的问题,如何杀掉对应的进程
Wechat brain competition answer applet_ Support the flow main belt with the latest question bank file
1091: two or three things in childhood (multi instance test)
The best way to learn SEO: search engine
JDBC learning notes
How MySQL merges data
杰理之开发板上电开机,就可以手机打开 NRF 的 APP【篇】
Configure raspberry pie access network
Setting and using richview trvstyle template style
Simple and understandable high-precision addition in C language
SSM学习
#systemverilog# 可综合模型的结构总结
杰理之BLE【篇】
Go learning --- use reflection to judge whether the value is valid
[online problem processing] how to kill the corresponding process when the MySQL table deadlock is caused by the code
杰理之如若需要大包发送,需要手机端修改 MTU【篇】