当前位置:网站首页>[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;
边栏推荐
- How MySQL merges data
- The psychological process from autojs to ice fox intelligent assistance
- leetcode841. Keys and rooms (medium)
- Bit operation XOR
- NiO programming introduction
- 1091: two or three things in childhood (multi instance test)
- 杰理之开发板上电开机,就可以手机打开 NRF 的 APP【篇】
- navicat如何导入MySQL脚本
- TypeScript 变量作用域
- How Navicat imports MySQL scripts
猜你喜欢

idea控制台彩色日志

Configure raspberry pie access network

Win10 64 bit Mitsubishi PLC software appears oleaut32 DLL access denied

Set picture annotation in markdown

Bugku CTF daily question: do you want seeds? Blackmailed

Top test sharing: if you want to change careers, you must consider these issues clearly!

微信公众号无限回调授权系统源码 全网首发

杰理之如若需要大包发送,需要手机端修改 MTU【篇】

【MySQL学习笔记32】mvcc

OpenGL ES 学习初识(1)
随机推荐
NFT on fingertips | evaluate ambire on G2, and have the opportunity to obtain limited edition collections
supervisor 使用文档
Thought map of data warehouse construction
The differences and advantages and disadvantages between cookies, seeion and token
Structure summary of SystemVerilog integrable model
Uni app practical project
On the world of NDK (2)
How to configure GUI guide development environment
Interface automation test framework: pytest+allure+excel
杰理之普通透传测试---做数传搭配 APP 通信【篇】
3. Business and load balancing of high architecture
How Navicat imports MySQL scripts
Idea console color log
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
OpenJudge NOI 2.1 1749:数字方格
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
Bloom taxonomy
剪映的相关介绍
【mysql学习笔记29】触发器
SEO学习的最好方式:搜索引擎