SQLSERVER中PERCENTILE_CONT和PERCENTILE_DISC
WITH test as ( select N'LeeWhoeeUniversity' as name,10 as score UNION ALL select N'LeeWhoeeUniversity',20 UNION ALL select N'LeeWhoeeUniversity',30 UNION ALL select N'LeeWhoeeUniversity',40 UNION ALL select N'LeeWhoeeUniversity',50 UNION A
WITH test
as
(
select N'LeeWhoeeUniversity' as name,10 as score
UNION ALL
select N'LeeWhoeeUniversity',20
UNION ALL
select N'LeeWhoeeUniversity',30
UNION ALL
select N'LeeWhoeeUniversity',40
UNION ALL
select N'LeeWhoeeUniversity',50
UNION ALL
select N'DePaul',60
UNION ALL
select N'DePaul',70
UNION ALL
select N'DePaul',80
UNION ALL
select N'DePaul',90
UNION ALL
select N'DePaul',100
)
select name,score
,PERCENT_RANK() over(partition by name order by score) as per_rnk
,PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY score) over(partition by name) as percont0_5
,PERCENTILE_CONT(0.6) WITHIN GROUP (ORDER BY score) over(partition by name) as percont0_6
,PERCENTILE_CONT(0.7) WITHIN GROUP (ORDER BY score) over(partition by name) as percont0_7
,PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY score) over(partition by name) as percont0_75
,PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY score) over(partition by name) as perdist0_5
,PERCENTILE_DISC(0.6) WITHIN GROUP (ORDER BY score) over(partition by name) as perdist0_6
,PERCENTILE_DISC(0.7) WITHIN GROUP (ORDER BY score) over(partition by name) as perdist0_7
,PERCENTILE_DISC(0.75) WITHIN GROUP (ORDER BY score) over(partition by name) as perdist0_75
from test
,上一篇: Chapter3ProtectingtheData(2):分配列级权限
下一篇: 急php有关问题
推荐阅读
-
SQLSERVER中PERCENTILE_CONT和PERCENTILE_DISC
-
B-Tree索引在sqlserver和mysql中的应用
-
SQLSERVER 2005中使用sql语句对xml文件和其数据的进行操作(很全
-
SQLSERVER中FIRST_VALUE和LAST_VALUE
-
sqlserver 中EXEC和sp
-
sqlserver中的guid的40位数和36位数的获得
-
SQLSERVER中的ALL、PERCENT、CUBE关键字和GROUPING函数
-
第十七章配置SQLServer(2)32位和64位系统中的内存配置
-
MySQL和sqlserver中判断表是否存在语句_MySQL
-
SQLServer中的通配符和转义字符