Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
18226849
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
18226849
编写于
8月 17, 2012
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Copy-editing for recent window-functions documentation rewrite.
Fix grammar, put back some removed information, rearrange for clarity.
上级
470d0b97
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
23 deletion
+45
-23
doc/src/sgml/syntax.sgml
doc/src/sgml/syntax.sgml
+45
-23
未找到文件。
doc/src/sgml/syntax.sgml
浏览文件 @
18226849
...
...
@@ -1742,13 +1742,6 @@ UNBOUNDED FOLLOWING
<para>
Here, <replaceable>expression</replaceable> represents any value
expression that does not itself contain window function calls.
<literal>PARTITION BY</> behaves like a <literal>GROUP
BY</> clause by grouping rows into partitions, except its
expressions are always just expressions and cannot be output-column
names or numbers. <literal>ORDER BY</> behaves similar to a
query-level <literal>ORDER BY</> clause, except it controls the
order rows are supplied to the aggregate function within the window
frame, and with the same expression restrictions.
</para>
<para>
...
...
@@ -1766,18 +1759,49 @@ UNBOUNDED FOLLOWING
</para>
<para>
In <literal>RANGE</> mode, <literal>CURRENT ROW</> starts with
the current row's first peer that <literal>ORDER BY</>
considers equivalent, and ends with its last equivalent peer. In
<literal>ROWS</> mode, <literal>CURRENT ROW</> simply starts and ends
with the current row.
The <literal>PARTITION BY</> option groups the rows of the query into
<firstterm>partitions</>, which are processed separately by the window
function. <literal>PARTITION BY</> works similarly to a query-level
<literal>GROUP BY</> clause, except that its expressions are always just
expressions and cannot be output-column names or numbers.
Without <literal>PARTITION BY</>, all rows produced by the query are
treated as a single partition.
The <literal>ORDER BY</> option determines the order in which the rows
of a partition are processed by the window function. It works similarly
to a query-level <literal>ORDER BY</> clause, but likewise cannot use
output-column names or numbers. Without <literal>ORDER BY</>, rows are
processed in an unspecified order.
</para>
<para>
The <replaceable class="parameter">frame_clause</replaceable> specifies
the set of rows constituting the <firstterm>window frame</>, which is a
subset of the current partition, for those window functions that act on
the frame instead of the whole partition. The frame can be specified in
either <literal>RANGE</> or <literal>ROWS</> mode; in either case, it
runs from the <replaceable>frame_start</> to the
<replaceable>frame_end</>. If <replaceable>frame_end</> is omitted,
it defaults to <literal>CURRENT ROW</>.
</para>
<para>
A <replaceable>frame_start</> of <literal>UNBOUNDED PRECEDING</> means
that the frame starts with the first row of the partition, and similarly
a <replaceable>frame_end</> of <literal>UNBOUNDED FOLLOWING</> means
that the frame ends with the last row of the partition.
</para>
<para>
In <literal>RANGE</> mode, a <replaceable>frame_start</> of
<literal>CURRENT ROW</> means the frame starts with the current row's
first <firstterm>peer</> row (a row that <literal>ORDER BY</> considers
equivalent to the current row), while a <replaceable>frame_end</> of
<literal>CURRENT ROW</> means the frame ends with the last equivalent
peer. In <literal>ROWS</> mode, <literal>CURRENT ROW</> simply means
the current row.
</para>
<para>
<literal>UNBOUNDED PRECEDING</> means that the frame
starts with the first row of the partition, and similarly
<literal>UNBOUNDED FOLLOWING</> means that the frame ends with the last
row of the partition.
The <replaceable>value</> <literal>PRECEDING</> and
<replaceable>value</> <literal>FOLLOWING</> cases are currently only
allowed in <literal>ROWS</> mode. They indicate that the frame starts
...
...
@@ -1789,15 +1813,13 @@ UNBOUNDED FOLLOWING
</para>
<para>
The <replaceable class="parameter">frame_clause</replaceable> specifies
the set of rows constituting the <firstterm>window frame</>, for those
window functions that act on the frame instead of the whole partition.
The default framing option is <literal>RANGE UNBOUNDED PRECEDING</>,
which is the same as <literal>RANGE BETWEEN UNBOUNDED PRECEDING AND
CURRENT ROW</>. With <literal>ORDER BY</>, this sets the frame to
be all rows from partition start up through the current row's
last peer. Without <literal>ORDER BY</>, all partition rows are
included in the window frame.
CURRENT ROW</>. With <literal>ORDER BY</>, this sets the frame to be
all rows from the partition start up through the current row's last
peer. Without <literal>ORDER BY</>, all rows of the partition are
included in the window frame, since all rows become peers of the current
row.
</para>
<para>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录