create function 函数名 (@pno int) returns int as begin declare @a int if not exists(select * from person where pno=@pno) set @a=-1 else set @a=1 return @...
分类:
数据库 时间:
2015-07-07 12:41:44
阅读次数:
134
//: Playground - noun: a place where people can playimportUIKit/*闭包Swift ====> ClosuresRuby OC ====> BlockPython C++11 ====> LambaJavescript =====> An...
分类:
其他好文 时间:
2015-07-07 12:39:47
阅读次数:
138
//: Playground - noun: a place where people can playimport UIKit//定义枚举//enum CompassPoint {// case North// case South// case East// case West//}//...
分类:
编程语言 时间:
2015-07-07 12:25:37
阅读次数:
130
GOIF EXISTS(SELECT 1 FROM sysobjects WHERE id=OBJECT_ID('usp_p_delDBLog'))BEGIN DROP PROC dbo.usp_p_delDBLogENDGOCREATE PROC usp_p_delDBLog( @DBLogSis...
分类:
数据库 时间:
2015-07-07 10:52:57
阅读次数:
161
1.查询数据库中的所有数据库名: SELECT Name FROM Master..SysDatabases ORDER BY Name2.查询某个数据库中所有的表名: SELECT Name FROM SysObjects Where XType='U' ORDER BY Name3.查询表结构信...
分类:
数据库 时间:
2015-07-07 10:43:31
阅读次数:
176
1.子查询是指在另一个查询语句中的SELECT子句。例句:SELECT * FROM t1 WHERE column1 = (SELECT column1 FROM t2);其中,SELECT * FROM t1 ...称为Outer Query[外查询](或者Outer Statement),SE...
分类:
数据库 时间:
2015-07-07 08:14:05
阅读次数:
244
对于 B-tree 和 hash 数据结构的理解能够有助于预测不同存储引擎下使用不同索引的查询性能的差异,尤其是那些允许你选择 B-tree 或者 hash 索引的内存存储引擎。B-Tree 索引的特点B-tree 索引可以用于使用 =, >, >=, SELECT * FROM tbl_name WHERE key_col LIKE 'Patrick%';
SELECT * FROM tbl_n...
分类:
其他好文 时间:
2015-07-06 21:45:13
阅读次数:
113
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited number of t...
分类:
其他好文 时间:
2015-07-06 21:45:12
阅读次数:
107
今天写了一个统计sql,在一个近亿条数据的表上执行,200s都查不出结果。SQL如下:
select customer,count(1) c
from upv_**
where created between "2015-07-06" and "2015-07-07"
group by customer
having c > 20
order by c desc
执行explain...
分类:
数据库 时间:
2015-07-06 19:52:22
阅读次数:
164
不管错在哪里,一般都是sql语法错误。---------------、要找到sql语句---------------粗一看,还以为是 1=1 这里出错了。去掉where这一句有可能编译通过。真实情况是,错误就是出在这一句上,但不是1=1这里,而是where前面少了一个空格,导致和上一句的表名连在一起...
分类:
其他好文 时间:
2015-07-06 17:20:36
阅读次数:
193