当前位置:网站首页>【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;
边栏推荐
- How to find a medical software testing institution? First flight software evaluation is an expert
- Go learning --- use reflection to judge whether the value is valid
- 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
- TS Basics
- Babbitt | metauniverse daily must read: the group image of Chinese Internet enterprises pouring into metauniverse: "there are only various survival desires, and there is no ambition for forward-lookin
- 这个高颜值的开源第三方网易云音乐播放器你值得拥有
- 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
- Multi attribute object detection on rare aircraft data sets: experimental process using yolov5
- UWA pipeline version 2.2.1 update instructions
- Lesson 12 study notes 2022.02.11
猜你喜欢

Go learning -- implementing generics based on reflection and empty interfaces

leetcode841. Keys and rooms (medium)

Week6 weekly report

mysql如何合并数据

Setting and using richview trvstyle template style

变量的命名规则十二条

leetcode704. Binary search (find an element, simple, different writing)

Raspberry pie 3B update VIM

Markdown 中设置图片图注

Missing monitoring: ZABBIX monitors the status of Eureka instance
随机推荐
ROS learning_ Basics
【线上问题处理】因代码造成mysql表死锁的问题,如何杀掉对应的进程
Oracle数据库11gr2使用tde透明数据加密报错ora28353,如果运行关闭wallet会报错ora28365,运行打开wallet就报错ora28353无法打开wallet
Leetcode 78: subset
Bloom taxonomy
Hydra common commands
这个高颜值的开源第三方网易云音乐播放器你值得拥有
Chrome view page FPS
What is the biggest problem that fresh e-commerce is difficult to do now
Twelve rules for naming variables
Uni app practical project
[hot100] 739. Température quotidienne
【服务器数据恢复】IBM服务器raid5两块硬盘离线数据恢复案例
Raspberry pie 3B update VIM
chrome查看页面fps
How to find a medical software testing institution? First flight software evaluation is an expert
升级版手机检测微信工具小程序源码-支持多种流量主模式
leetcode704. Binary search (find an element, simple, different writing)
Crawling exercise: Notice of crawling Henan Agricultural University
#systemverilog# 可综合模型的结构总结