Home > Database > Mysql Tutorial > body text

九、mysql触发器的概念_MySQL

WBOY
Release: 2016-05-31 08:46:53
Original
848 people have browsed it
  1. 1.所谓触发器,就是指设置好某个表的某个操作(insert ,update ,delete)时候,同时触发的一个操作;  一般用来,比如说删除文章主栏目,那么可以利用触发器删除这个文章栏目下的所有文章2.创建触发器    delimiter $$    create trigger ins_1    before insert on tt1 for each row    BEGIN    insert into tt2 values (now());    END;    $$        以上触发器,大概意思就是:当tt1有进行插入操作之间,即执行tt2插入操作,再执行tt1插入操作!!    PS::    before insert 插入之前执行    after insert 插入之后执行    before update 更新之前执行    after update  更新之后执行3.drop trigger ins_1 删除名为 ins_1的触发器4.show triggers 查看所有触发器
    Copy after login

     

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!