• Mysql 学习笔记05


    1 Mysql 触发器

         1 触发器的应用:

             可以在更改表数据时对其他的数据进行关联的更新操作。一个动作,会触发另一个动作。

         2 创建语法:

            create trigger + 名称, before/after  + insert/update/delete + on +表名(对那个表进行监控)

           +  for each row 

           + begine 

           + 触发sql

           + end;

    例如 : create trigger t1

                  before insert

                  on goods(表名)

                 for each row

                 begine

                 update ord set num  = nu-new.much where gid = new.gid;

                 end;(监控 goods 表 当向goods表中添加数据时,会 触发更新的sql 去更新ord表的数据)

                 注 :for each row 的含义是会根据 insert 语句影响的行数去更新 ord 表相同的行数,不能省略。称为行级触发,在oracle 中已经省略,则为语句级触发。

  • 相关阅读:
    GridView的简单使用
    获取当前应用程序的版本号
    Android EditText输入光标居于开头最开始位置
    Linux-开机启动程序-chkconfig
    Linux-显示行号-方案
    Linux-命令-cat
    Linux-测试-第二关
    Linux-正则-Reg
    Linux-测试-第一关
    Linux-命令-uname
  • 原文地址:https://www.cnblogs.com/wjgbok/p/10795131.html
Copyright © 2020-2023  润新知