mysql实例中的每一个trigger 对应到information_schema.triggers 中有一行

1、information_schema.triggers 表的常用列:

  1、trigger_catalog          :永远是def

  2、trigger_schema          :trigger 所在的数据库名

  3、event_manipulation        :触发trigger 的事件类型可以是 insert | update | delete

  4、event_object_schema        :trigger 所基于的表所在的数据库名

  5、event_object_table        :trigger 所基于的表名

  6、action_statement         :trigger 内部所包涵的SQL语句

2、例子:

drop table if exists t;
drop table if exists t_log;create table t(
id int auto_increment,
x int,
constraint pk__t__id primary key(id))
engine=innodb
default char set utf8;create table t_log(
id int auto_increment,
log_time datetime default now(),
constraint pk__t_log__id primary key(id))
engine=innodb
default char set utf8;delimiter go
create trigger tg__insert__t
before insert
on t
for each row
begininsert into t_log(log_time) values(current_timestamp());
end
godelimiter ;

查看trigger 信息:

mysql> select * from triggers \G
*************************** 1. row ***************************TRIGGER_CATALOG: defTRIGGER_SCHEMA: tempdbTRIGGER_NAME: tg__insert__tEVENT_MANIPULATION: INSERTEVENT_OBJECT_CATALOG: defEVENT_OBJECT_SCHEMA: tempdbEVENT_OBJECT_TABLE: tACTION_ORDER: 0ACTION_CONDITION: NULLACTION_STATEMENT: begininsert into t_log(log_time) values(current_timestamp());
endACTION_ORIENTATION: ROWACTION_TIMING: BEFORE
ACTION_REFERENCE_OLD_TABLE: NULL
ACTION_REFERENCE_NEW_TABLE: NULLACTION_REFERENCE_OLD_ROW: OLDACTION_REFERENCE_NEW_ROW: NEWCREATED: NULLSQL_MODE: STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTIONDEFINER: root@localhostCHARACTER_SET_CLIENT: utf8COLLATION_CONNECTION: utf8_general_ciDATABASE_COLLATION: latin1_swedish_ci

转载于:https://www.cnblogs.com/JiangLe/p/5814394.html

information_schema.triggers 学习相关推荐

  1. information_schema.columns 学习

    information_schema.columns 学习 每一个表中的每一列都会在information_schema.columns表中对应一行 1.informaiton_schema.colu ...

  2. ORACLE中triggers灰色的,Oracle之Triggers学习与测试_20091229

    Oracle Triggers学习与测试 <>P475 <>P567 目录 1 Introduction to Triggers 1.1 The events that fir ...

  3. information_schema.routines 学习

    information_schema.routines 用户查看mysql中的routine信息 1.information_schema.routines 表中的常用列: 1. 转载于:https: ...

  4. information_schema.character_sets 学习

    information_schema.character_sets 表用于查看字符集的详细信息 1.character_sets 常用列说明: 1.character_set_name: 字符集名 2 ...

  5. information_schema.engines学习

    当前mysql实例的存储引擎信息可以从information_schema.engines 中查询到 例子: mysql> select * from information_schema.en ...

  6. 学习SQL:INFORMATION_SCHEMA数据库

    The best way how to explain what the INFORMATION_SCHEMA database is would be – "This is the dat ...

  7. mysql数据库应用_MySQL数据库应用 从入门到精通 学习笔记

    以下内容是学习<MySQL数据库应用 从入门到精通>过程中总结的一些内容提要,供以后自己复现使用. 一:数据库 查看所有数据库:SHOW DATABASES 创建数据库:CREATE DA ...

  8. 史上最全:PostgreSQL DBA常用SQL查询语句(建议收藏学习)

    编者的话:PostgreSQL连续两年被评为年度数据库,备受很多DBA的青睐,本文我们一起来了解学习PostgreSQL常用的查询语句有哪些? 查看帮助命令 DB=# help --总的帮助 DB=# ...

  9. sql:命名管道管道程序_学习SQL:命名约定

    sql:命名管道管道程序 A naming convention is a set of unwritten rules you should use if you want to increase ...

最新文章

  1. LeetCode 36 Valid Sudoku(有效数独)(*)
  2. ACM-ICPC 2018 南京赛区网络预赛 L. Magical Girl Haze 最短路+分层图
  3. ibatis解决sql注入问题 .
  4. golang beego快速入门示例(单文件hello.go)
  5. JUC原子类-数组类型(三)
  6. mysql主从同步slave_MySQL主从复制(Master-Slave)实践
  7. java多线程打印helloworld,Java并发编程--多线程之HelloWorld
  8. 解决复杂多数据源报表的5种通用办法
  9. Notepad++便签模式
  10. [ZJOI 2012]灾难
  11. Windows服务器管理(3)——IIS服务器误删了Default Web Site 网站 解决方法
  12. 操作键盘事件源码解析(常用的鼠标事件、 键盘事件对象之keyCode属性)
  13. POJ3748 位操作【位运算+STL】
  14. poj 2182 Lost Cows 线段树!!!!
  15. 前端实战项目:前端框架Vue3.0项目教程(一)Vue3.0环境的搭建
  16. 怎么把ppt文字大小设置一致_PPT基础入门技巧,这都不会?就别谈制作PPT了,学会瞬间提高档次...
  17. win10去掉微软拼音的简繁体转换
  18. Linux中的bin文件夹
  19. 数显之家快讯:【SHIO世硕心语】未来15年,重点关注8大前沿领域,9大战略产业
  20. 借鉴华为HiLink实现微信小程序智能配网功能

热门文章

  1. 双重惊喜——Windows Phone Developer Tools初体验
  2. golang教程汇总
  3. SaaS加速器 I 商业中心:提供商业助力 共享商业成功
  4. Crystal For Rubyists 简体中文
  5. DM368启动串口打印分析
  6. 用Visual Studio开发以太坊智能合约
  7. zabbix_get 无法获取值(解决思路)
  8. VC模仿超炫QQ界面的实现
  9. Dell遇载软件出问题!可能被安装软件含有病毒
  10. SQLServer之函数简介