O'Reilly logo

MySQL in a Nutshell by Russell J.T. Dyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Mathematical and Aggregate Functions

MySQL has many built-in mathematical and aggregate functions that you can use in SQL statements for performing calculations on values in databases. Functions in this chapter include those used for statistical information, such as counting rows and determining the average of a given column’s value.

You should be aware of a few factors regarding some of these functions: all mathematical functions return NULL when there is an error. If an aggregate function is used without a GROUP BY clause, it operates on all rows. The following aggregate functions require a GROUP BY clause: AVG(), BIT_AND( ), BIT_OR( ), BIT_XOR( ), COUNT(), GROUP_CONCAT( ), MIN( ), MAX( ), STD( ), STDDEV( ), SUM( ), VARIANCE( ).

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required