一、字符串转日期下面将讲述如何在MYSQL中把一个字符串转换成日期:背景:rq字段信息为:201009011、无需转换的:SELECT * FROM tairlist_day WHERE rq>'2010-07-31' AND rq'2010-08-01' AND DATE_FORMAT( rq, ...
分类:
数据库 时间:
2015-03-02 14:28:45
阅读次数:
143
$cache=S('newskey'); if(!$cache){ $cache=M('news')->cache(true,60,'newskey')->where('state=1')->order('publishtime desc')->limit(5)->sel...
分类:
Web程序 时间:
2015-03-02 14:27:04
阅读次数:
174
一、1 CREATE TABLE NAME(name VARCHAR(10)); ??? ??? 对这个表,缺省情况下,下面两个查询的结果是一样的: ?? ???? SELECT * FROM TABLE NAME WHERE name=‘clip‘; ??? ??? SELECT * FROM TA...
分类:
数据库 时间:
2015-03-02 09:43:46
阅读次数:
164
一、前言
WHERE条件用不到索引的情况下如何删除大表记录?
文章中只是列举出其中一种方式而已,但仍然存在很多不严谨的地方.只是
轻描淡写随着数据表越来越大,历史数据的处理将越来越困难.且过滤字段没有索引(如时间)字段,而创建索引是需要临时表空间排序的.有越来越大,创建的维护工作也随之越来越难.
除了本文介绍的方法以外,还可以通过以下几种方法来维护历史数据:
1. 创建历史表,将历史...
分类:
其他好文 时间:
2015-03-02 09:37:38
阅读次数:
202
Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Ncis the number of distinct common numbers shared by the two...
分类:
其他好文 时间:
2015-03-01 18:21:51
阅读次数:
181
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
A partially fille...
分类:
其他好文 时间:
2015-03-01 15:45:20
阅读次数:
136
曾经遇到过这样一个需求:要求为method传入String,内容如"用户ID0,用户ID1,用户ID2...",然后根据这些ID返回一个结果集作为数据表供别人查询。SELECT * FROM TBL WHERE ID IN ('用户ID0,用户ID1,用户ID2') 不就可以解决问题吗?但实际情况是...
分类:
数据库 时间:
2015-03-01 15:34:43
阅读次数:
205
1 --从Table 表中取出第 m 条到第 n 条的记录:(Not In 版本) 2 Select TOP n-m+1 * 3 FROM Table 4 Where (id NOT IN (Select TOP m-1 id FROM Table )) 5 6 7 --从TABLE表...
分类:
数据库 时间:
2015-03-01 14:26:19
阅读次数:
159
聚集函数group by可以用来汇总数据,这使得我们可以对行精选计数,计算平均数,获得最大和最小值。
但是往往我们对于分组只需要选出特定条件的。where和having是很多初学者容易搞混淆的,它们的区别:
where是过滤行的,在分组之前;
having是在分组之后,过滤分组的。...
分类:
其他好文 时间:
2015-02-28 23:02:54
阅读次数:
220
--判断数据库是否存在if exists(select * from master..sysdatabases where name=N'库名')print'Exist'elseprint'Not Exist'--判断表是否存在if object_id(N'表名',N'U') is not null...
分类:
数据库 时间:
2015-02-28 23:00:05
阅读次数:
210