一、概念介绍:
Analytic functions compute an aggregate value based on a group of rows. They differ from aggregate functions in that they return multiple rows for each group. The group of rows is called a window and is defined by the analytic_clause. For each row, a sliding window of rows is defined. The window determines the range of rows used to perform the calculations for the current row. Window sizes can be based on either a physical number of rows or a logical interval such as time.
分析函数基于一组行记录来计算聚合值。不同于聚合函数,分析函数为每一组返回多行记录。这里所谓的组就是分析条件语句(analytic_clause)定义的窗口(window)。窗口决定了用于计算的行范围。窗口大小可以用多个物理行大小或者逻辑区间进行度量例如时间。
Analytic functions are the last set of operations performed in a query except for the final ORDER BY clause. All joins and all WHoracle账号ERE, GROUP BY, and HAVING clauses are completed before the analytic functions are processed. Therefore, analytic functions can appear only in the select list or ORDER BY clause.
分析函数式查询中除需要再最终处理的order by子句之外最后执行的操作。所有连接和where, group by和having子句都在分析函数之前完成。因此,分析函数只能用于选择列或order by子句中。
Analytic functions are commonly used to compute cumulative, moving, centered, and reporting aggregates.
分析函数通常用于计算累积值,数据移动值,中间值和报告聚合值。
二 语法介绍: