1994.4.16
by Marisa Plumb
new function and clause files, some placeholders for right now |
1 |
Aggregate Functions
|
1994.4.37
by Marisa Plumb
modifications to functions |
2 |
===================
|
1994.4.16
by Marisa Plumb
new function and clause files, some placeholders for right now |
3 |
|
1994.4.37
by Marisa Plumb
modifications to functions |
4 |
SQL group (aggregate) functions operate on sets of values. If you use an aggregate function in a statement containing no GROUP BY clause, it is equivalent to grouping on all rows. |
1994.4.16
by Marisa Plumb
new function and clause files, some placeholders for right now |
5 |
|
6 |
General syntax for aggregate functions is: ::
|
|
7 |
||
8 |
SELECT "function type" ("column_name")
|
|
1994.4.37
by Marisa Plumb
modifications to functions |
9 |
FROM "table_name";
|
10 |
||
11 |
The following are examples of aggregate functions: |
|
12 |
||
13 |
**AVG**: Return the average value of the argument. (Does not work with temporal values unless first converted to numeric values.)
|
|
14 |
||
15 |
:doc:`count` |
|
16 |
(DISTINCT): Return the count of a number of different values |
|
17 |
||
18 |
:doc:`count`: Return a count of the number of rows returned |
|
19 |
||
20 |
**GROUP_CONCAT**: Return a concatenated string
|
|
21 |
||
22 |
**MAX**: Return the maximum value
|
|
23 |
||
24 |
**MIN**: Return the minimum value
|
|
25 |
||
26 |
**STD**: Return the population standard deviation
|
|
27 |
||
28 |
**STDDEV_POP**: Return the population standard deviation
|
|
29 |
||
30 |
**STDDEV_SAMP**: Return the sample standard deviation
|
|
31 |
||
32 |
**STDDEV**: Return the population standard deviation
|
|
33 |
||
34 |
**SUM**: Return the sum. (Does not work with temporal values unless first converted to numeric values.)
|
|
35 |
||
36 |
**VAR_POP**: Return the population standard variance
|
|
37 |
||
38 |
**VAR_SAMP**: Return the sample variance
|
|
39 |
||
40 |
**VARIANCE**: Return the population standard variance
|
|
41 |
||
42 |
.. toctree:: |
|
43 |
:hidden:
|
|
44 |
||
45 |
count |