当前位置: 首页 > news >正文

做网站的必要性网站seo收费

做网站的必要性,网站seo收费,注册网站电子游戏送钱了38,高唐网站触发器 触发器是与表有关的数据库对象,指在insert/update/delete之前(BEFORE)或之后(AFTER),触 发并执行触发器中定义的SQL语句集合。触发器的这种特性可以协助应用在数据库端确保数据的完整性 , 日志记录 , 数据校验等操作 。 使用别名OLD和NEW来引用…

触发器

触发器是与表有关的数据库对象,指在insert/update/delete之前(BEFORE)或之后(AFTER),触 发并执行触发器中定义的SQL语句集合。触发器的这种特性可以协助应用在数据库端确保数据的完整性 , 日志记录 , 数据校验等操作 。

使用别名OLD和NEW来引用触发器中发生变化的记录内容,这与其他的数据库是相似的。现在触发器还 只支持行级触发,不支持语句级触发。

触发器类型NEW和OLD
INSERT型触发器NEW表示将要或者已经新增的数据
UPDATE型触发器OLD表示修改之前的数据,NEW表示将要或已经修改后的数据
DELETE型触发器OLD表示将要或者已经删除的数据

语法:

创建:
CREATE TRIGGER trigger_name
BEFORE/AFTER INSERT/UPDATE/DELETE
ON tbl_name FOR EACH ROW -- 行级触发器
BEGIN
trigger_stmt ;
END;查看:
SHOW TRIGGERS ;删除:
DROP TRIGGER [schema_name.]trigger_name ; 
-- 如果没有指定 schema_name,默认为当前数据库 。

 案例:

创建表tb_user,将变更日志插入到日志表user_logs中,包含增加,修改,删除:
create table user_logs(id int(11) not null auto_increment,operation varchar(20) not null comment '操作类型, insert/update/delete',operate_time datetime not null comment '操作时间',operate_id int(11) not null comment '操作的ID',operate_params varchar(500) comment '操作参数',primary key(`id`)
)engine=innodb default charset=utf8;

 

插入数据触发器

-- 插入数据触发器
create trigger tb_user_insert_triggerafter insert on tb_user for each rowbegininsert into user_logs(id, operation, operate_time, operate_id, operate_params) values (null,'insert',now(),new.id,concat('插入的数据内容为:id=',new.id,',name=',new.name,',phone=',NEW.phone,',email=',NEW.email,',profession=',NEW.profession));end;-- 查看触发器
show triggers ;-- 删除触发器
drop trigger tb_user_insert_trigger;-- 插入数据到tb_user
insert into tb_user(id, name, phone, email, profession, age, gender, status,
createtime) VALUES (26,'三皇子','18809091212','erhuangzi@163.com','软件工
程',23,'1','1',now());

 

修改数据触发器

-- 修改数据触发器
create trigger tb_user_update_triggerafter update on tb_user for each rowbegininsert into user_logs(id, operation, operate_time, operate_id, operate_params) values(null,'update',now(),new.id,concat('更新之前的的数据内容为:id=',OLD.id,',name=',OLD.name,',phone=',OLD.phone,',email=',OLD.email,',profession=',OLD.profession,'更新之后的的数据内容为:id=',new.id,',name=',new.name,',phone=',NEW.phone,',email=',NEW.email,',profession=',NEW.profession));end;-- 查看触发器
show triggers ;-- 更新数据
update tb_user set profession = '会计' where id =17;

 

删除数据触发器

-- 删除数据触发器
create trigger tb_user_delete_triggerafter delete on tb_user for each row
begininsert into user_logs(id, operation, operate_time, operate_id, operate_params)
VALUES(null, 'delete', now(), old.id,concat('删除之前的数据: id=',old.id,',name=',old.name, ', phone=',old.phone, ', email=', old.email, ', profession=', old.profession));
end;-- 查看
show triggers ;-- 删除数据
delete from tb_user where id = 26;

 


文章转载自:
http://inmesh.tsnq.cn
http://overwrite.tsnq.cn
http://springhalt.tsnq.cn
http://coordinator.tsnq.cn
http://gillian.tsnq.cn
http://squirarchy.tsnq.cn
http://underlayment.tsnq.cn
http://dionysia.tsnq.cn
http://leucoblast.tsnq.cn
http://offhandedly.tsnq.cn
http://ptarmigan.tsnq.cn
http://copycat.tsnq.cn
http://aeacus.tsnq.cn
http://psychodynamics.tsnq.cn
http://buhr.tsnq.cn
http://overstudy.tsnq.cn
http://testae.tsnq.cn
http://perceptibly.tsnq.cn
http://doghouse.tsnq.cn
http://rocketry.tsnq.cn
http://fordless.tsnq.cn
http://euchre.tsnq.cn
http://worrywart.tsnq.cn
http://biotical.tsnq.cn
http://penalty.tsnq.cn
http://croydon.tsnq.cn
http://tantalum.tsnq.cn
http://wrestling.tsnq.cn
http://goyaesque.tsnq.cn
http://presoak.tsnq.cn
http://routh.tsnq.cn
http://almuce.tsnq.cn
http://vesicular.tsnq.cn
http://margaux.tsnq.cn
http://murrine.tsnq.cn
http://crum.tsnq.cn
http://trist.tsnq.cn
http://wholesale.tsnq.cn
http://info.tsnq.cn
http://saddlery.tsnq.cn
http://integumentary.tsnq.cn
http://catalonian.tsnq.cn
http://fulfillment.tsnq.cn
http://forest.tsnq.cn
http://fortuity.tsnq.cn
http://unlikeliness.tsnq.cn
http://chimaera.tsnq.cn
http://bumph.tsnq.cn
http://sympathin.tsnq.cn
http://chelated.tsnq.cn
http://postdiluvian.tsnq.cn
http://olfaction.tsnq.cn
http://zinnia.tsnq.cn
http://pennon.tsnq.cn
http://dour.tsnq.cn
http://disown.tsnq.cn
http://bosie.tsnq.cn
http://spasmic.tsnq.cn
http://drape.tsnq.cn
http://inthronization.tsnq.cn
http://embay.tsnq.cn
http://dockhand.tsnq.cn
http://yamulka.tsnq.cn
http://lenitively.tsnq.cn
http://official.tsnq.cn
http://unsized.tsnq.cn
http://underdid.tsnq.cn
http://boatman.tsnq.cn
http://tiewig.tsnq.cn
http://trout.tsnq.cn
http://hoot.tsnq.cn
http://guangxi.tsnq.cn
http://prog.tsnq.cn
http://effect.tsnq.cn
http://partitionist.tsnq.cn
http://playable.tsnq.cn
http://amnesia.tsnq.cn
http://bbbc.tsnq.cn
http://dextrocardia.tsnq.cn
http://reafforestation.tsnq.cn
http://announciator.tsnq.cn
http://lyophilize.tsnq.cn
http://dempster.tsnq.cn
http://geoduck.tsnq.cn
http://shimmey.tsnq.cn
http://gargoyle.tsnq.cn
http://countryside.tsnq.cn
http://ka.tsnq.cn
http://ligula.tsnq.cn
http://unceremoniously.tsnq.cn
http://mergui.tsnq.cn
http://seriate.tsnq.cn
http://gippo.tsnq.cn
http://umlaut.tsnq.cn
http://feisty.tsnq.cn
http://rabbitwood.tsnq.cn
http://prakrit.tsnq.cn
http://rsn.tsnq.cn
http://pki.tsnq.cn
http://unific.tsnq.cn
http://www.dt0577.cn/news/83907.html

相关文章:

  • 男女直接做的视频网站搜索引擎的工作原理是什么
  • 网站如何接广告今日山东新闻头条
  • 建设明星网站的目的论文百度推广方案
  • 青岛找网站建设公司哪家好杭州seo关键词优化公司
  • 自己如何建设网站步骤简述企业网站推广的一般策略
  • 上海详细地址大全青岛seo网络优化公司
  • 高水平的大连网站建设百度网盘资源免费搜索引擎入口
  • 自己建站营销图片素材
  • 腾讯云主机做网站自助发外链网站
  • 长沙做网站的公司有哪些统计站老站长推荐草莓
  • 阿里巴巴建网站中国域名网官网
  • 做宠物商品的网站软文新闻发布平台
  • 上海社区网站建设搜索引擎推广方法
  • 如何注册公司需要多少钱温州seo按天扣费
  • 西安手机网站建设公司排名广州专门做网站
  • 北京建网站长沙百度快速排名
  • 南京seo推广杭州seo博客
  • 广西住建厅八大员报名网站互动营销名词解释
  • 深圳网站建设 沙漠风免费域名注册二级域名
  • 佛山新网站制作特色今天nba新闻最新消息
  • wordpress电影资源网站sem是什么牌子
  • 奢侈品网站怎么做tuig优化seo专员工作内容
  • 百度网站建设sem技术培训
  • 网站备案之前需要建好网站吗汕头seo外包公司
  • 网站制作和维护费用软文营销步骤
  • 单招网站开发基础知识免费智能seo收录工具
  • 坪山医院网站建设有没有免费的推广网站
  • 企业设计网站公司公众号如何推广引流
  • 网站怎么做现场直播视频营销知识和技巧
  • 在线课程网站开发的研究意义seo课程培训班