当前位置:网站首页>【mysql学习笔记29】触发器
【mysql学习笔记29】触发器
2022-07-06 07:13:00 【yqs_281876918】
创建
CREATE TRIGGER trigger_name
BEFORE/AFTER INSERT/UPDATE/DELETE
ON tb_name FOR EACH ROW – 行级触发器
BEGIN
trigger_statement;
END;
查看
SHOW TRIGGERS;
删除
DROP TRIGGER [schema_name.]trigger_name; --没有指定schema_name默认为当前数据库
案例
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('插入的数据内容为:',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('更新前数据:',old.content));
end;
边栏推荐
- TS基础篇
- Cif10 actual combat (resnet18)
- Entity Developer数据库应用程序的开发
- Fast target recognition based on pytorch and fast RCNN
- Oracle database 11gr2 uses TDE transparent data encryption to report an error ora28353. If you run to close the wallet, you will report an error ora28365. If you run to open the wallet, you will repor
- [hot100] 739. Température quotidienne
- On the world of NDK (2)
- 呆错图床系统源码图片CDN加速与破解防盗链功能
- Chrome view page FPS
- C语言 简单易懂的高精度加法
猜你喜欢
Solution to the problem of breakthrough in OWASP juice shop shooting range
Raspberry pie serial port login and SSH login methods
[daily question] 729 My schedule I
What is the biggest problem that fresh e-commerce is difficult to do now
Cookie Technology & session Technology & ServletContext object
“无聊猿” BAYC 的内忧与外患
作者已死?AI正用艺术征服人类
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
巴比特 | 元宇宙每日必读:中国互联网企业涌入元宇宙的群像:“只有各种求生欲,没有前瞻创新的雄心”...
Missing monitoring: ZABBIX monitors the status of Eureka instance
随机推荐
巴比特 | 元宇宙每日必读:中国互联网企业涌入元宇宙的群像:“只有各种求生欲,没有前瞻创新的雄心”...
(4) Web security | penetration testing | network security web site source code and related analysis
kubernetes集群搭建Zabbix监控平台
【服务器数据恢复】IBM服务器raid5两块硬盘离线数据恢复案例
Multithreading and concurrent programming (2)
ROS learning_ Basics
leetcode704. Binary search (find an element, simple, different writing)
#systemverilog# 可綜合模型的結構總結
Markdown 中设置图片图注
PCL realizes frame selection and clipping point cloud
Entity Developer数据库应用程序的开发
【JDBC】快速入门教程
树莓派3B更新vim
Wechat brain competition answer applet_ Support the flow main belt with the latest question bank file
Compile, connect -- notes-2
MPLS experiment
How to find a medical software testing institution? First flight software evaluation is an expert
Introduction to the basics of network security
Internal and external troubles of "boring ape" bayc
Cookie技术&Session技术&ServletContext对象