.group by order by
select siteid count(*)as from webdb where gathtrime between '2017-06-14 00:00:00' and '2017-06-14 23:59:59' group by siteid order by 1desc
in limit
select * from sitemanage where url in (select url from curl) limit ,
时间
select* from sitemanage where siteid= and gathertime>'2017-06-12 00:00:00‘ order by gathertime desc
update sitemanage set updatestrategy= where id in (select siteid from webde where newurl!='(null)' order by siteid ASC)
5update sitemanage set =replace(url,'','')
.SELECT id, url, configs FROM sitemanage WHERE (INSTR(configs, 'div.title>')>)
SELECT id, url, configs FROM sitemanage WHERE (INSTR(configs, '<filterreg>')=)
.SELECT * FROM sitemanage WHERE (INSTR(configs, 'h1')>) ORDER BY url ASC LIMIT ,
update sitemanage set sitemanage.vname = (select vname from contrast where sitemanage.id=contrast.id)
url中含有中文汉字
9SELECT url FROM sitemanage WHERE length(url )!=char_length(url) SELECT id FROM siteid2 WHERE id NOT in (SELECT id FROM metasearchconf_id WHERE id BETWEEN AND ) AND (id BETWEEN AND ) LIMIT update sitemanage set updatestrategy=, configs= replace (configs,'<titlefilter><![CDATA[td.title]]></titlefilter>','<titlefilter><![CDATA[table.title>tr>td[align=center]]]></titlefilter>') WHERE url LIKE 'http://www.ln.gov.cn%'
#SELECT * from sitemanage where id in (SELECT id from contrast)
#update sitemanage set updatestrategy= where id in (SELECT id from contrast)
#select count(id) from sitemanage WHERE updatestrategy= and (id in (SELECT id from contrast))
查询部分:
1、等值连接(from a,b)>外连接(from a left join b)>子查询。
2、依照小结果驱集驱动大结果集的原则写where条件的顺序。
3、不使用not in ,可用 not exists代替。
4、尽量减少对字符串、时间类型字段用>、<,可用between and代替。    条件列中不可使用函数 例如:Year(publishtime)>2016。
5、多表查询中数据量大时,用关联代替  in,不要使用or 连接。
6、养成用explain 检测语句效率
7、多表查询最好的优化方式是建视图,提高表的逻辑独立性,还可以屏蔽原有表结构变化带来的影响。 索引部分:
1、一个查询只能用到一个索引,也就是where条件与索引配合使用的必要性。
2、选择建立单列索引还是复合索引,复合索引同样是依照从左到右的顺序,而且一定要将使用频率最高的字段放在左边。若第一个没有与条件匹配到,则其他字段的索引不会被使用。
3、关联查询时,条件两边字段类型相同并且都建有索引才会提速。
4、建过索引的字段默认值不要为null
5、Like  ‘%XXX%’是不会用到索引的,但like ‘xxxx%’会被用到。
6、尽量不要对大文本或长字符串建索引,可以建前缀索引。
7、经常有删除操作的表、或有大量长文本的表要定期进行碎片整理。用MyISAM引擎为例,我们对表做删除操作时,data中的*.MYD文件的大小是不会变小,会影响我们的存储与查询。所以要定期做清理(OPTIMIZE TABLE  `***`可多个表‘,’连接)
8\\表中时间段查询语句
SELECT COUNT(url) FROM  wise_web_docinfo  WHERE  gathertime BETWEEN '2016-05-30 00:00:00' AND '2016-05-30 23:00:00'
9\\url 模糊查询
SELECT * FROM  sitemanage WHERE url LIKE '%0634%'
10\\根据url字段,更改表中的其他字段
UPDATE sitemanage SET category='论坛D' ,updatestrategy=2 WHERE url LIKE '%0634%'
11\\in条件,limit条件查询
SELECT * FROM webdb  WHERE url  in(select url from curl ) LIMIT 0,1000
12\\时间查询
SELECT?*?FROM?wise_web_docinfo?WHERE??site_id?=-7651?AND?gathertime?>'2016-07-12?00:00:00'?ORDER?BY?gathertime?DESC
13\\in
SELECT * FROM sitemanage WHERE id IN (SELECT siteid FROM waitlist WHERE newurl != '(NULL)' ORDER BY siteid ASC)
14
UPDATE   sitemanage SET updatestrategy=3  WHERE id IN (SELECT siteid FROM waitlist WHERE newurl != '(NULL)' ORDER BY siteid ASC)
15
SELECT * FROM `thai_com` ORDER BY gathertime LIMIT 0, 10;
16
update `baidutieba`  set  url= replace (url,'http://tieba.baidu.com//f?kw','http://tieba.baidu.com/f?kw')

最新文章

  1. getWinSystemIcon
  2. 测试驱动开发(Test-Driven Development,简称TDD)--单元测试--&gt;提高代码质量
  3. easyui使用技巧
  4. Activity之间的数据传递
  5. Golang学习 - unicode 包
  6. [老老实实学WCF] 第十篇 消息通信模式(下) 双工
  7. Ⅸ.spring的点点滴滴--IObjectFactory与IFactoryObject的杂谈
  8. Uva 1354 Mobile Computing
  9. Bone Collector(ZeroOnebag)
  10. Nubia Z5S 基于官方H207/4.4内核的Mokee4.4.4 RC3.2 (2014.7.31修复呼吸灯(能亮依旧不能呼吸))
  11. Git安装使用
  12. Java基础语法&lt;五&gt; 大数值BigInteger BigDecimal
  13. mac下IDLE无法输入中文的问题
  14. android集成twitter登录
  15. Linux之文件、目录
  16. 系统右键菜单(级联菜单)资料--cascading menus
  17. 在UnrealEngine中用Custom节点实现毛玻璃的效果
  18. access十万级数据分页
  19. leetcode1026
  20. Liquibase使用入门

热门文章

  1. SPFA的两个(卡时)优化
  2. Yii 之cookie的使用
  3. vue之条件渲染
  4. raspi集成库及安装
  5. stm32的IIc总线--超声波测距
  6. Android-一张图理解MVP的用法
  7. Word2vector原理
  8. BUPT复试专题—矩阵幂(2012)
  9. Java 实现 淘宝秒杀 聚划算 自己主动提醒 源代码
  10. Solidworks如何绘制装饰螺纹线