在数据库表中,对字段建立索引可以大大提高查询速度。假如我们创建了一个 mytable表:复制代码代码如下:CREATE TABLE mytable( ID INT NOT NULL, username VARCHAR(16) NOT NULL );我们随机向里面插入了10000条记录,其中有一条:5555, admin。在查找userna...【阅读全文】
看个sql文的结果select '2015-12-03 23:59:59.999' + ' will stored into db like :' + convert(varchar, convert(datetime, '2015-12-03 23:59:59.999'),121)union allselect '2015-12-03 23:59:59.998' + ' will stored into db like :' + convert(varchar, convert(datetime, '2015-12-...【阅读全文】
SimilarityBoth the functions accepts two arguments to search the specified text filed in the given expression.Both the function returns the starting position of the matching pattern given in the function.DifferenceThe PatIndex function is used with the wildcard characters. You must enclosed t...【阅读全文】
迭代检索原理就是WITH语句做一个临时表【DAYS】,在UNION ALL的下半部分从【DAYS】临时表中检索YMD的前一天,当【DAYS】表中的YMD大于等于当前日期的前10天迭代停止WITH DAYS AS (SELECT CURRENT_TIMESTAMP AS YMD UNION ALL SELECT DATEADD(Y, -1, YMD) FROM DAYS WHERE DAYS.Y...【阅读全文】