For numeric arguments, the variance and standard deviation
functions return a DOUBLE value.
The SUM() and
AVG() functions return a
DECIMAL value for exact-value
arguments (integer or DECIMAL),
and a DOUBLE value for
approximate-value arguments
(FLOAT or
DOUBLE).

The SUM() and
AVG() aggregate functions do not
work with temporal values. (They 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:

mysql> SELECT student.student_name,COUNT(*)
-> FROM student,course
-> WHERE student.student_id=course.student_id
-> GROUP BY student_name;

COUNT(*) is somewhat
different in that it returns a count of the number of rows
retrieved, whether or not they contain
NULL values.

COUNT(*) is optimized to
return very quickly if the
SELECT retrieves from one
table, no other columns are retrieved, and there is no
WHERE clause. For example:

mysql> SELECT COUNT(*) FROM student;

This optimization applies only to MyISAM
tables only, because an exact row count is stored for this
storage engine and can be accessed very quickly. For
transactional storage engines such as
InnoDB, storing an exact row count is
more problematic because multiple transactions may be
occurring, each of which may affect the count.

In MySQL, you can obtain the number of distinct expression
combinations that do not contain NULL by
giving a list of expressions. In standard SQL, you would
have to do a concatenation of all expressions inside
COUNT(DISTINCT ...).

In MySQL, you can get the concatenated values of expression
combinations. To eliminate duplicate values, use the
DISTINCT clause. To sort values in the
result, use the ORDER BY clause. To sort
in reverse order, add the DESC
(descending) keyword to the name of the column you are
sorting by in the ORDER BY clause. The
default is ascending order; this may be specified explicitly
using the ASC keyword. The default
separator between values in a group is comma
(“,”). To specify a
separator explicitly, use SEPARATOR
followed by the string literal value that should be inserted
between group values. To eliminate the separator altogether,
specify SEPARATOR ''.

The result is truncated to the maximum length that is given
by the group_concat_max_len
system variable, which has a default value of 1024. The
value can be set higher, although the effective maximum
length of the return value is constrained by the value of
max_allowed_packet. The
syntax to change the value of
group_concat_max_len at
runtime is as follows, where val
is an unsigned integer:

SET [GLOBAL | SESSION] group_concat_max_len = val;

The return value is a nonbinary or binary string, depending
on whether the arguments are nonbinary or binary strings.
The result type is TEXT or
BLOB unless
group_concat_max_len is
less than or equal to 512, in which case the result type is
VARCHAR or
VARBINARY.

Returns the maximum value of
expr.
MAX() may take a string
argument; in such cases, it returns the maximum string
value. See Section 8.3.1, “How MySQL Uses Indexes”. The
DISTINCT keyword can be used to find the
maximum of the distinct values of
expr, however, this produces the
same result as omitting DISTINCT.

For MAX(), MySQL currently
compares ENUM and
SET columns by their string
value rather than by the string's relative position in the
set. This differs from how ORDER BY
compares them. This is expected to be rectified in a future
MySQL release.

Returns the minimum value of
expr.
MIN() may take a string
argument; in such cases, it returns the minimum string
value. See Section 8.3.1, “How MySQL Uses Indexes”. The
DISTINCT keyword can be used to find the
minimum of the distinct values of
expr, however, this produces the
same result as omitting DISTINCT.

For MIN(), MySQL currently
compares ENUM and
SET columns by their string
value rather than by the string's relative position in the
set. This differs from how ORDER BY
compares them. This is expected to be rectified in a future
MySQL release.

Returns the population standard variance of
expr. It considers rows as the
whole population, not as a sample, so it has the number of
rows as the denominator. You can also use
VARIANCE(), which is
equivalent but is not standard SQL.