@@ -1390,7 +1390,7 @@ There are a few restrictions on operator names, however:
1390
1390
-->
1391
1391
<para>
1392
1392
星号(<literal>*</literal>)在某些环境里表示一个表的全部字段或者一个复合类型的值。
1393
- 在用作聚集函数的参数时还表示该聚集并不需要明确的参数 。
1393
+ 在用作聚合函数的参数时还表示该聚合并不需要明确的参数 。
1394
1394
</para>
1395
1395
</listitem>
1396
1396
@@ -1898,7 +1898,7 @@ the <literal>OPERATOR</> construct is taken to have the default precedence
1898
1898
</para>
1899
1899
-->
1900
1900
<para>
1901
- 一个聚集表达式
1901
+ 一个聚合表达式
1902
1902
</para>
1903
1903
</listitem>
1904
1904
@@ -2352,7 +2352,7 @@ The list of built-in functions is in <xref linkend="functions">.
2352
2352
<!--
2353
2353
<title>Aggregate Expressions</title>
2354
2354
-->
2355
- <title>聚集表达式 </title>
2355
+ <title>聚合表达式 </title>
2356
2356
<indexterm zone="syntax-aggregates">
2357
2357
<primary>aggregate function</primary>
2358
2358
<secondary>invocation</secondary>
@@ -2366,9 +2366,9 @@ An <firstterm>aggregate expression</firstterm> represents the
2366
2366
output value, such as the sum or average of the inputs. The
2367
2367
syntax of an aggregate expression is one of the following:
2368
2368
-->
2369
- 一个<firstterm>聚集表达式 </firstterm>代表一个聚集函数对查询选出的行的处理 。
2370
- 一个聚集函数把多个输入缩减为一个输出值 ,比如给输入求和或求平均。
2371
- 一个聚集表达式的语法是下列之一 :
2369
+ 一个<firstterm>聚合表达式 </firstterm>代表一个聚合函数对查询选出的行的处理 。
2370
+ 一个聚合函数把多个输入缩减为一个输出值 ,比如给输入求和或求平均。
2371
+ 一个聚合表达式的语法是下列之一 :
2372
2372
<synopsis>
2373
2373
<replaceable>aggregate_name</replaceable> (<replaceable>expression</replaceable> [ , ... ] [ <replaceable>order_by_clause</replaceable> ] )
2374
2374
<replaceable>aggregate_name</replaceable> (ALL <replaceable>expression</replaceable> [ , ... ] [ <replaceable>order_by_clause</replaceable> ] )
@@ -2385,8 +2385,8 @@ An <firstterm>aggregate expression</firstterm> represents the
2385
2385
<replaceable>order_by_clause</replaceable> is a optional
2386
2386
<literal>ORDER BY</> clause as described below.
2387
2387
-->
2388
- 这里的<replaceable>aggregate_name</replaceable>是前面定义的聚集 (可能是带有模式的全称),
2389
- 而<replaceable>expression</replaceable>是一个本身不包含聚集表达式或一个窗口函数调用的任意值表达式 。
2388
+ 这里的<replaceable>aggregate_name</replaceable>是前面定义的聚合 (可能是带有模式的全称),
2389
+ 而<replaceable>expression</replaceable>是一个本身不包含聚合表达式或一个窗口函数调用的任意值表达式 。
2390
2390
<replaceable>order_by_clause</replaceable>是<literal>ORDER BY</> 子句的一个选项,下面会有描述。
2391
2391
</para>
2392
2392
@@ -2405,11 +2405,11 @@ An <firstterm>aggregate expression</firstterm> represents the
2405
2405
</para>
2406
2406
-->
2407
2407
<para>
2408
- 第一种形式的聚集表达式为每个输入行调用聚集 。
2408
+ 第一种形式的聚合表达式为每个输入行调用聚合 。
2409
2409
第二种形式与第一种等价(因为<literal>ALL</literal>是缺省值)。
2410
- 第三种形式为每个表达式中不同的值调用聚集 (或者为多个表达式不同的值的集合)。
2411
- 最后一种形式为每个输入行调用一次聚集 ,因为没有声明特定的输入值,
2412
- 通常它只用于<function>count(*)</function>聚集函数 。
2410
+ 第三种形式为每个表达式中不同的值调用聚合 (或者为多个表达式不同的值的集合)。
2411
+ 最后一种形式为每个输入行调用一次聚合 ,因为没有声明特定的输入值,
2412
+ 通常它只用于<function>count(*)</function>聚合函数 。
2413
2413
</para>
2414
2414
<!--
2415
2415
<para>
@@ -2420,8 +2420,8 @@ An <firstterm>aggregate expression</firstterm> represents the
2420
2420
</para>
2421
2421
-->
2422
2422
<para>
2423
- 大多数的聚集函数忽略了NULL输入 ,因此在一个或多个表达式中产生NULL的行会被丢弃。
2424
- 对所有的内置聚集函数而言 ,这样做是可以的,除非另行说明。
2423
+ 大多数的聚合函数忽略了NULL输入 ,因此在一个或多个表达式中产生NULL的行会被丢弃。
2424
+ 对所有的内置聚合函数而言 ,这样做是可以的,除非另行说明。
2425
2425
</para>
2426
2426
<!--
2427
2427
<para>
@@ -2453,10 +2453,10 @@ Ordinarily, the input rows are fed to the aggregate function in an
2453
2453
are always just expressions and cannot be output-column names or numbers.
2454
2454
For example:
2455
2455
-->
2456
- 一般情况下,输入行会以非特定顺序放入到聚集函数中 。在许多情况下,这样做是没有影响的;
2456
+ 一般情况下,输入行会以非特定顺序放入到聚合函数中 。在许多情况下,这样做是没有影响的;
2457
2457
如,无论以什么顺序输入,<function>min</>输出相同的结果。然而,
2458
- 一些聚集函数 (如<function>array_agg</> 和 <function>string_agg</>)并非如此。
2459
- 当使用这种聚集函数时 ,可以用<replaceable>order_by_clause</>选项指定输入的顺序。
2458
+ 一些聚合函数 (如<function>array_agg</> 和 <function>string_agg</>)并非如此。
2459
+ 当使用这种聚合函数时 ,可以用<replaceable>order_by_clause</>选项指定输入的顺序。
2460
2460
除了它的表达式仅仅只是表达式,并且不能输出列名或列数之外,<replaceable>order_by_clause</>
2461
2461
与<literal>ORDER BY</>查询子句有相同的语法结构,在<xref linkend="queries-order">中有描述,如:
2462
2462
<programlisting>
@@ -2470,7 +2470,7 @@ SELECT array_agg(a ORDER BY b DESC) FROM table;
2470
2470
<literal>ORDER BY</> clause goes after all the aggregate arguments.
2471
2471
For example, write this:
2472
2472
-->
2473
- 在处理多参数聚集函数时需要注意 ,<literal>ORDER BY</>子句要在所有的聚集函数参数之后 ,如这样写:
2473
+ 在处理多参数聚合函数时需要注意 ,<literal>ORDER BY</>子句要在所有的聚合函数参数之后 ,如这样写:
2474
2474
2475
2475
<programlisting>
2476
2476
SELECT string_agg(a, ',' ORDER BY a) FROM table;
@@ -2486,7 +2486,7 @@ SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
2486
2486
(the second one being rather useless since it's a constant).
2487
2487
-->
2488
2488
后者在语法上是有效的,但它表示的是,
2489
- 有两个<literal>ORDER BY</>关键字的单参数的聚集函数的调用 (第二个是无用的,
2489
+ 有两个<literal>ORDER BY</>关键字的单参数的聚合函数的调用 (第二个是无用的,
2490
2490
因为它是一个常量)。
2491
2491
</para>
2492
2492
@@ -2501,7 +2501,7 @@ SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
2501
2501
-->
2502
2502
<para>
2503
2503
如果<replaceable>order_by_clause</>中声明了<literal>DISTINCT</>,
2504
- 那么所有的<literal>ORDER BY</>表达式必须匹配规则的聚集参数 ,也就是说,
2504
+ 那么所有的<literal>ORDER BY</>表达式必须匹配规则的聚合参数 ,也就是说,
2505
2505
不能对没有包含在<literal>DISTINCT</>列表中的表达式进行排序。
2506
2506
</para>
2507
2507
<note>
@@ -2512,7 +2512,7 @@ SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
2512
2512
</para>
2513
2513
-->
2514
2514
<para>
2515
- 同时在一个聚集函数中声明 <literal>DISTINCT</>和<literal>ORDER BY</>是<productname>PostgreSQL</>的一个扩展。
2515
+ 同时在一个聚合函数中声明 <literal>DISTINCT</>和<literal>ORDER BY</>是<productname>PostgreSQL</>的一个扩展。
2516
2516
</para>
2517
2517
</note>
2518
2518
@@ -2524,7 +2524,7 @@ SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
2524
2524
</para>
2525
2525
-->
2526
2526
<para>
2527
- 预定义的聚集函数在 <xref linkend="functions-aggregate">里描述。其它聚集函数可以由用户增加 。
2527
+ 预定义的聚合函数在 <xref linkend="functions-aggregate">里描述。其它聚合函数可以由用户增加 。
2528
2528
</para>
2529
2529
<!--
2530
2530
<para>
@@ -2536,8 +2536,8 @@ SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
2536
2536
</para>
2537
2537
-->
2538
2538
<para>
2539
- 一个聚集表达式只能在 <command>SELECT</>命令的结果列表或者<literal>HAVING</>子句里出现。
2540
- 禁止在其它子句里出现(比如<literal>WHERE</>子句),因为这些子句逻辑上在生成聚集结果之前计算 。
2539
+ 一个聚合表达式只能在 <command>SELECT</>命令的结果列表或者<literal>HAVING</>子句里出现。
2540
+ 禁止在其它子句里出现(比如<literal>WHERE</>子句),因为这些子句逻辑上在生成聚合结果之前计算 。
2541
2541
</para>
2542
2542
<!--
2543
2543
<para>
@@ -2556,12 +2556,12 @@ SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
2556
2556
</para>
2557
2557
-->
2558
2558
<para>
2559
- 如果一个聚集表达式出现在一个子查询里 (参阅<xref linkend="sql-syntax-scalar-subqueries">
2560
- 和<xref linkend="functions-subquery">),聚集通常是在子查询中进行计算 。
2561
- 但是如果聚集的参数只包含外层查询的变量则例外:这个聚集会属于离他最近的外层查询 ,
2562
- 并且在该查询上进行计算。该聚集表达式整体上属于它出现的子查询对外层查询的引用 ,
2563
- 其作用相当于子查询每一次计算中的一个常量。前述限制(聚集表达式只能出现在结果列或者
2564
- <literal>HAVING</>子句中)只适用于聚集所属的查询层 。
2559
+ 如果一个聚合表达式出现在一个子查询里 (参阅<xref linkend="sql-syntax-scalar-subqueries">
2560
+ 和<xref linkend="functions-subquery">),聚合通常是在子查询中进行计算 。
2561
+ 但是如果聚合的参数只包含外层查询的变量则例外:这个聚合会属于离他最近的外层查询 ,
2562
+ 并且在该查询上进行计算。该聚合表达式整体上属于它出现的子查询对外层查询的引用 ,
2563
+ 其作用相当于子查询每一次计算中的一个常量。前述限制(聚合表达式只能出现在结果列或者
2564
+ <literal>HAVING</>子句中)只适用于聚合所属的查询层 。
2565
2565
</para>
2566
2566
</sect2>
2567
2567
@@ -2591,7 +2591,7 @@ SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
2591
2591
list) of the window function call.
2592
2592
The syntax of a window function call is one of the following:
2593
2593
-->
2594
- 通过查询筛选出的行的某些部分,<firstterm>窗口调用函数</firstterm>实现了类似于聚集函数的功能 。
2594
+ 通过查询筛选出的行的某些部分,<firstterm>窗口调用函数</firstterm>实现了类似于聚合函数的功能 。
2595
2595
不同的是,窗口调用函数不需要将查询结果打包成一行输出—在查询输出中,每一行都是分开的。
2596
2596
然而,窗口调用函数可以扫描所有的行,根据窗口调用函数的分组规范(<literal>PARTITION BY</>列),
2597
2597
这些行可能会是当前行所在组的一部分。一个窗口调用函数的语法是下列之一:
@@ -2757,7 +2757,7 @@ UNBOUNDED FOLLOWING
2757
2757
<para>
2758
2758
<replaceable>value</> <literal>PRECEDING</>和<replaceable>value</> <literal>FOLLOWING</>
2759
2759
当前只允许<literal>ROWS</>模式。这也就意味着,框架从当前行之前或之后指定的行数启动或结束。
2760
- <replaceable>value</replaceable>必须是整型表达式,而不能包含变量,聚集函数 ,或者窗口函数。
2760
+ <replaceable>value</replaceable>必须是整型表达式,而不能包含变量,聚合函数 ,或者窗口函数。
2761
2761
该值不能为空或负,但可以是零,表示只选择当前行本身。
2762
2762
</para>
2763
2763
<!--
@@ -2804,7 +2804,7 @@ UNBOUNDED FOLLOWING
2804
2804
-->
2805
2805
<para>
2806
2806
内置窗口函数在<xref linkend="functions-window-table">中有描述。其他窗口函数,
2807
- 用户可以自己添加。同样,任意内置或用户自定义聚集函数可以同窗口函数一样使用 。
2807
+ 用户可以自己添加。同样,任意内置或用户自定义聚合函数可以同窗口函数一样使用 。
2808
2808
</para>
2809
2809
<!--
2810
2810
<para>
@@ -2818,9 +2818,9 @@ UNBOUNDED FOLLOWING
2818
2818
</para>
2819
2819
-->
2820
2820
<para>
2821
- 使用<literal>*</>的语法可以用来调用无参数的聚集函数为窗口函数 ,如
2821
+ 使用<literal>*</>的语法可以用来调用无参数的聚合函数为窗口函数 ,如
2822
2822
<literal>count(*) OVER (PARTITION BY x ORDER BY y)</>。星号(<literal>*</>)
2823
- 通常不用于非聚集的窗口函数。与通常的聚集函数不同,聚集窗口函数不允许在函数参数列中使用
2823
+ 通常不用于非聚合的窗口函数。与通常的聚合函数不同,聚合窗口函数不允许在函数参数列中使用
2824
2824
<literal>DISTINCT</>或<literal>ORDER BY</>。
2825
2825
</para>
2826
2826
<!--
0 commit comments