摘要:
【语法】RANK ( ) OVER ( [query_partition_clause] order_by_clause ) dense_RANK ( ) OVER ( [query_partition_clause] order_by_clause ) 【功能】聚合函数RANK 和 dense_r 阅读全文
摘要:
select id,area, sum(1) over() as 总记录数, sum(1) over(partition by id) as 分组记录数, sum(score) over() as 总计 , sum(score) over(partition by id) as 分组求和, sum( 阅读全文
摘要:
将score按ID分组排名:cume_dist() over(partition by id order by score desc)*sum(1) over(partition by id) 将score不分组排名:cume_dist() over(order by score desc)*sum 阅读全文
摘要:
函数:cume_dist() over(order by id) select id,area,score, cume_dist() over(order by id) a, --按ID最大排名/总个数 cume_dist() over(partition by id order by score 阅读全文
摘要:
将score按ID分组排名:dense_rank() over(partition by id order by score desc) 将score不分组排名:dense_rank() over(order by score desc) select id,area,score, dense_ra 阅读全文
摘要:
将score按ID分组排名:row_number() over(partition by id order by score desc) 将score不分组排名:row_number() over(order by score desc) select id,area,score, row_numb 阅读全文
摘要:
将score按ID分组排名:rank() over(partition by id order by score desc) 将score不分组排名:rank() over(order by score desc) select id,area,score, rank() over(partitio 阅读全文
摘要:
/*从上面的结果中我们很容易发现,每个统计数据所对应的行都会出现null, 如何来区分到底是根据那个字段做的汇总呢,grouping函数判断是否合计列!*/ select decode(grouping(id),1,'all id',id) id, decode(grouping(area),1,' 阅读全文
摘要:
select id,area,stu_type,sum(score) score from students group by cube(id,area,stu_type) order by id,area,stu_type; /* 理解cube select a, b, c, sum( d ) f 阅读全文
摘要:
select id,area,stu_type,sum(score) score from students group by rollup(id,area,stu_type) order by id,area,stu_type; 阅读全文