Oracle 5.0 Reference Manual page 989

Table of Contents

Advertisement

Name
[972]
STDDEV()
[972]
SUM()
[972]
VAR_POP()
[972]
VAR_SAMP()
[972]
VARIANCE()
This section describes group (aggregate) functions that operate on sets of values. Unless otherwise
stated, group functions ignore
If you use a group function in a statement containing no
on all rows. For more information, see
For numeric arguments, the variance and standard deviation functions return a
[972]
and
SUM()
AVG()
or DECIMAL), and a
DOUBLE
MySQL 5.0.3,
[972]
SUM()
The
[972]
and
SUM()
AVG()
convert the values to numbers, losing everything after the first nonnumeric character.) To work
around this problem, convert to numeric units, perform the aggregate operation, and convert back to a
temporal value. Examples:
SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(time_col))) FROM tbl_name;
SELECT FROM_DAYS(SUM(TO_DAYS(date_col))) FROM tbl_name;
Functions such as
SUM()
to a number if necessary. For
value to be used.
AVG([DISTINCT] expr)
Returns the average value of expr. The
the average of the distinct values of expr.
[969]
returns
AVG()
mysql>
SELECT student_name, AVG(test_score)
->
FROM student
->
GROUP BY student_name;
[969]
BIT_AND(expr)
Returns the bitwise
AND
precision.
This function returns
an unsigned
BIGINT
[969]
BIT_OR(expr)
Returns the bitwise
OR
precision.
This function returns
[969]
BIT_XOR(expr)
Returns the bitwise
XOR
precision.
(Aggregate) Functions
GROUP BY
Description
Return the population standard deviation
Return the sum
Return the population standard variance
Return the sample variance
Return the population standard variance
values.
NULL
Section 12.15.3, "MySQL Extensions to
[969]
functions return a
value for approximate-value arguments
and
[969]
return
AVG()
[969]
aggregate functions do not work with temporal values. (They
[972]
or
[969]
AVG()
or
values, the cast operation causes the underlying numeric
SET
ENUM
[969]
DISTINCT
if there were no matching rows.
NULL
of all bits in expr. The calculation is performed with 64-bit (BIGINT)
18446744073709551615
value with all bits set to 1.)
of all bits in expr. The calculation is performed with 64-bit (BIGINT)
if there were no matching rows.
0
[881]
of all bits in expr. The calculation is performed with 64-bit (BIGINT)
969
clause, it is equivalent to grouping
GROUP BY
value for exact-value arguments (integer
DECIMAL
(FLOAT
for all numeric arguments.)
DOUBLE
that expect a numeric argument cast the argument
option can be used as of MySQL 5.0.3 to return
if there were no matching rows. (This is the value of
GROUP
BY".
value. The
DOUBLE
or DOUBLE). (Before

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents