码迷,mamicode.com
首页 > 数据库 > 详细

navicate mysql 触发器

时间:2015-04-10 18:17:23      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:

1.新建两张测试表,number表和users表。

        number表字段(id,number,name)

        users表字段(id,name)

2.打开users表,设计表->触发器

    名字(自定义),触发(After),选上插入

3.在定义里编辑文本保存

    begin
     update number
     set number = (select count(*) from tusers),name= NEW.name where id=1 ;
    end

4.测试,不断新增users表数据,number表字段number和name会对应修改为users表的总记录数和新增的name值。

navicate mysql 触发器

标签:

原文地址:http://my.oschina.net/aicoding/blog/398582

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!