Mysql Aggregate functions

Source: Internet
Author: User

The following describes the Mysql Aggregate functions used in combination with group by. If you are interested in Mysql Aggregate functions, I believe they will help you.

Unless otherwise specified, Mysql Aggregate functions ignore null records.

Unless otherwise specified, Mysql Aggregate functions return null if no matching record set is null.

If you use the Mysql aggregate function in a statement that does not use group by, it is equivalent to grouping all rows.

Aggregate (GROUP BY) Functions

Name Description
AVG() Return the average value of the argument
BIT_AND() Return bitwise and
BIT_OR() Return bitwise or
BIT_XOR()(V4.1.1) Return bitwise xor
COUNT(DISTINCT) Return the count of a number of different values
COUNT() Return a count of the number of rows returned
GROUP_CONCAT()(V4.1) Return a concatenated string
MAX() Return the maximum value
MIN() Return the minimum value
STDDEV_POP()(V5.0.3)STDDEV()  STD() Return the population standard deviation
STDDEV_SAMP()(V5.0.3) Return the sample standard deviation
SUM() Return the sum
VAR_POP()(V5.0.3)VARIANCE()(V4.1) Return the population standard variance
VAR_SAMP()(V5.0.3) Return the sample variance

Bit_and () If no rows are returned, it is the largest unsigned bigint INTEGER:18446744073709551615

Bit_or () and bit_xor () are 0 if no rows are returned.

Count *) returns the data of all rows, including null. If no row is returned, it is 0.

Countexpr) returns all non-null data. If no row is returned, it is 0.

Countdistinct expr) returns all non-null data. If no row is returned, it is 0. It is not compatible with SQL standards. standard SQL returns the number of rows of all different data, including null values.

MySQL string case-sensitive Conversion Function

Use of MySQL concat Functions

Implementation of MySql remote connection

MySQL primary key design principles

MySQL partition functions and restrictions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.