随笔分类 - 数据库
数据库
摘要:http://blog.sqlauthority.com/2011/03/08/sql-server-difference-between-countdistinct-vs-countall/COUNT(DISTINCT)和COUNT(ALL)的区别:前者像select distinct 字段1,字段2 from table一样会去掉重复的,后者则是统计字段的所有数据条数,与Count(字段1)相同。COUNT(ALL)中的ALL实际上是缺省项,不需要指定。(注:本人还有点怀疑COUNT(ALL)与COUNT(字段1)是否有区别,待验证)。Here is the script:1 SELECT
阅读全文
摘要:SQL Azure Performance – Query Optimization:http://www.sqlazureperformance.com/2010/sql-azure-performance-query-optimization/Simple Query tuning with STATISTICS IO and Execution plans:http://www.simple-talk.com/sql/performance/simple-query-tuning-with-statistics-io-and-execution-plans/显示图形执行计划 (SQL S
阅读全文
摘要:DECLARE @table TABLE(gd varchar(100), [time] datetime)INSERT INTO @table SELECT 'gd550765', '2009-08-14 16:02:07.293'UNION ALL SELECT 'gd550765', '2009-08-14 16:19:41.000'UNION ALL SELECT 'gd550765', ...
阅读全文
摘要:在查找问题的时候,无意搜索到这个Blog:http://blogs.x2line.com,发现有好一些内容不错,实际项目完全有可能用到,特收集起来1、SQL Tip: HowTo Convert Delimited String to TableMany times we need to deal with lists in T-SQL, for instance we need to have ...
阅读全文