BEGIN
IF (select new.name NOT REGEXP (SELECT IF((select filterword from t_crawl_configuration where id=new.crawl_id)='','fzuir',(select filterword from t_crawl_configuration where id=new.crawl_id))) and new.price>=(select lowest_price from t_crawl_configuration where id=new.crawl_id)) then
insert into t_product_data(crawl_url_id,pid,name,price,crawl_id) values(new.crawl_url_id,new.pid,new.name,new.price,new.crawl_id);
end if;
END

插入表格过程中建立触发器

-- 触发器 同时插入有用数据
DROP TRIGGER IF EXISTS t_afterinsert_on_t_product;
CREATE TRIGGER t_afterinsert_on_t_product
AFTER INSERT ON t_product
FOR EACH ROW
BEGIN
IF (select new.name NOT REGEXP (SELECT IF((select filterword from t_crawl_configuration where id=new.crawl_id)='','fzuir',(select filterword from t_crawl_configuration where id=new.crawl_id))) and new.price>=(select lowest_price from t_crawl_configuration where id=new.crawl_id)) then
insert into t_product_data(crawl_url_id,pid,name,price,crawl_id) values(new.crawl_url_id,new.pid,new.name,new.price,new.crawl_id);
end if;
END; -- 触发器 同时插入有用数据
DROP TRIGGER IF EXISTS t_afterinsert_on_t_product_test;
CREATE TRIGGER t_afterinsert_on_t_product_test
AFTER INSERT ON t_product_test
FOR EACH ROW
BEGIN
IF (select new.name NOT REGEXP (SELECT IF((select filterword from t_crawl_configuration where id=new.crawl_id)='','fzuir',(select filterword from t_crawl_configuration where id=new.crawl_id))) and new.price>=(select lowest_price from t_crawl_configuration where id=new.crawl_id)) then
insert into t_product_data(crawl_url_id,pid,name,price,crawl_id) values(new.crawl_url_id,new.pid,new.name,new.price,new.crawl_id);
end if;
END;

MySQL 缓存表建触发器的更多相关文章

  1. 点评阿里JAVA手册之MySQL数据库 (建表规约、索引规约、SQL语句、ORM映射)

    下载原版阿里JAVA开发手册  [阿里巴巴Java开发手册v1.2.0] 本文主要是对照阿里开发手册,注释自己在工作中运用情况. 本文内容:MySQL数据库 (建表规约.索引规约.SQL语句.ORM映 ...

  2. MySQL 查询 存储过程 视图 触发器 函数 索引 建表语句 数据库版本 当前登录用户 当前数据库名称

    MySQL 查询 存储过程 视图 触发器 函数 索引 建表语句 数据库版本 当前登录用户 当前数据库名称   INFORMATION_SCHEMA.TABLES INFORMATION_SCHEMA. ...

  3. Django2.0--创建缓存表

    创建缓存表 在项目的虚拟环境下(若有),执行:python manage.py createcachetab

  4. 详解MySQL大表优化方案( 转)

    当MySQL单表记录数过大时,增删改查性能都会急剧下降,可以参考以下步骤来优化: 单表优化 除非单表数据未来会一直不断上涨,否则不要一开始就考虑拆分,拆分会带来逻辑.部署.运维的各种复杂度,一般以整型 ...

  5. MySQL 大表优化方案探讨

    当MySQL单表记录数过大时,增删改查性能都会急剧下降,可以参考以下步骤来优化: 单表优化 除非单表数据未来会一直不断上涨,否则不要一开始就考虑拆分,拆分会带来逻辑.部署.运维的各种复杂度,一般以整型 ...

  6. MySQL大表优化方案

    转:https://segmentfault.com/a/1190000006158186?hmsr=toutiao.io&utm_medium=toutiao.io&utm_sour ...

  7. MySQL 大表优化方案

    当MySQL单表记录数过大时,增删改查性能都会急剧下降,可以参考以下步骤来优化: 单表优化 除非单表数据未来会一直不断上涨,否则不要一开始就考虑拆分,拆分会带来逻辑.部署.运维的各种复杂度,一般以整型 ...

  8. 优秀后端架构师必会知识:史上最全MySQL大表优化方案总结

    本文原作者“ manong”,原创发表于segmentfault,原文链接:segmentfault.com/a/1190000006158186 1.引言   MySQL作为开源技术的代表作之一,是 ...

  9. MySQL 大表优化方案(长文)

    当MySQL单表记录数过大时,增删改查性能都会急剧下降,可以参考以下步骤来优化: 单表优化 除非单表数据未来会一直不断上涨,否则不要一开始就考虑拆分,拆分会带来逻辑.部署.运维的各种复杂度,一般以整型 ...

随机推荐

  1. Storm简述及集群安装

    Storm 集群类似于一个 Hadoop 集群.然而你在 Hadoop 的执行"MapReduce job", 在storm 上你执行 "topologies (不好翻译 ...

  2. Linux链接文件ln

    链接命令:ln 生成链接文件   ln [源文件] [目标目录] : 创建硬链接 -s:创建软链接    硬链接特征:(ln )1.拥有相同的i节点和存储block快,可以看做是同一个文件2.可通过i ...

  3. CentOS 6.5上使用gdb调试时出现Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6.i686 .

    在CentOS6.5上用gdb调试时提示Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6.i686先修改 ...

  4. java操作hdfs到数据库或者缓存

    使用hadoop工具将数据分析出来以后,须要做入库处理或者存到缓存中.不然就没了意义 一下是使用javaAPI操作hdfs存入缓存的代码: <span style="font-fami ...

  5. poj-----Ultra-QuickSort(离散化+树状数组)

    Ultra-QuickSort Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 38258   Accepted: 13784 ...

  6. HDU 1757 A Simple Math Problem (矩阵乘法)

    A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Ot ...

  7. Ubuntu16.04 安装RabbitMQ

    转载https://www.cnblogs.com/hongdada/p/7203589.html 安装RabbitMQ 由于rabbitMq需要erlang语言的支持,在安装rabbitMq之前需要 ...

  8. python学习笔记011——函数式编程

    1 函数式编程 面向对象 ,面向过程 ,函数式编程 侧重函数的作用,注重函数结果的传递 函数可以被赋值,也可以接受其他的值 2 函数式编程特点 1.函数是一等公民 与其他变量一样,可以赋值和被赋值,可 ...

  9. JMeter学习笔记--使用HTTP信息头管理器

    使用HTTP信息头管理,可以帮助测试人员设定JMeter发送的HTTP请求头所包含的信息.HTTP信息头中包含有”User-Agent".“Pragma".”Referer&quo ...

  10. ASP.NET MVC ajax处理 AjaxResult

    1.统一ASPNET MVC 对ajax请求响应格式定义,方便前端统一处理ajax结果. 1)定义程序返回结果数据格式 /// <summary> /// 执行结果 /// </su ...