当前位置:网站首页>[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;
边栏推荐
- 数字IC设计笔试题汇总(一)
- 可变参数重载时的内存错误
- Go learning --- use reflection to judge whether the value is valid
- OpenJudge NOI 2.1 1661:Bomb Game
- 微信脑力比拼答题小程序_支持流量主带最新题库文件
- JDBC学习笔记
- Résumé de la structure du modèle synthétisable
- 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
- UWA pipeline version 2.2.1 update instructions
- Simple and understandable high-precision addition in C language
猜你喜欢
树莓派串口登录与SSH登录方法
呆错图床系统源码图片CDN加速与破解防盗链功能
Missing monitoring: ZABBIX monitors the status of Eureka instance
C - Inheritance - polymorphism - virtual function member (lower)
WPF之MVVM
杰理之BLE【篇】
leetcode704. Binary search (find an element, simple, different writing)
数字IC设计笔试题汇总(一)
Idea console color log
word中如何删除某符号前面或后面所有的文字
随机推荐
Raspberry pie serial port login and SSH login methods
变量的命名规则十二条
Crawling exercise: Notice of crawling Henan Agricultural University
呆错图床系统源码图片CDN加速与破解防盗链功能
Markdown 中设置图片图注
Sélectionnez toutes les lignes avec un symbole dans Word et changez - les en titre
Uni app practical project
“无聊猿” BAYC 的内忧与外患
[server data recovery] case of offline data recovery of two hard disks of IBM server RAID5
Oracle column to row -- a field is converted to multiple rows according to the specified separator
巴比特 | 元宇宙每日必读:中国互联网企业涌入元宇宙的群像:“只有各种求生欲,没有前瞻创新的雄心”...
1189. Maximum number of "balloons"
首发织梦百度推送插件全自动收录优化seo收录模块
Cookie Technology & session Technology & ServletContext object
学go之路(一)go的基本介绍到第一个helloworld
Setting and using richview trvstyle template style
SEO学习的最好方式:搜索引擎
杰理之蓝牙设备想要发送数据给手机,需要手机先打开 notify 通道【篇】
Cookie技术&Session技术&ServletContext对象
JDBC learning notes