~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/aggregatefunctions.rst

modifications to functions

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Aggregate Functions
2
 
===================
 
2
===================
3
3
 
4
 
*SQL aggregate functions are calculated from values in a column, and return a single value.*
 
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.
5
5
 
6
6
General syntax for aggregate functions is: ::
7
7
 
8
8
        SELECT "function type" ("column_name")
9
 
        FROM "table_name"
10
 
 
11
 
The following are examples of aggregate functions:
12
 
 
13
 
    * AVG() - Returns the average value
14
 
    * COUNT() - Returns the number of rows
15
 
    * FIRST() - Returns the first value
16
 
    * LAST() - Returns the last value
17
 
    * MAX() - Returns the largest value
18
 
    * MIN() - Returns the smallest value
19
 
    * SUM() - Returns the sum
 
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
**BIT_AND**:  Return bitwise and
 
16
 
 
17
**BIT_OR**:  Return bitwise or
 
18
 
 
19
**BIT_XOR**:  Return bitwise xor
 
20
 
 
21
:doc:`count`
 
22
(DISTINCT):  Return the count of a number of different values
 
23
 
 
24
:doc:`count`:  Return a count of the number of rows returned
 
25
        
 
26
**GROUP_CONCAT**:  Return a concatenated string
 
27
 
 
28
**MAX**:  Return the maximum value
 
29
 
 
30
**MIN**:  Return the minimum value
 
31
 
 
32
**STD**:  Return the population standard deviation
 
33
 
 
34
**STDDEV_POP**:  Return the population standard deviation
 
35
 
 
36
**STDDEV_SAMP**:  Return the sample standard deviation
 
37
 
 
38
**STDDEV**:  Return the population standard deviation
 
39
 
 
40
**SUM**:  Return the sum. (Does not work with temporal values unless first converted to numeric values.)
 
41
 
 
42
**VAR_POP**:  Return the population standard variance
 
43
 
 
44
**VAR_SAMP**:  Return the sample variance
 
45
 
 
46
**VARIANCE**:  Return the population standard variance
 
47
 
 
48
.. toctree::
 
49
   :hidden: 
 
50
 
 
51
   count