Aggregate functions


show more Aggregate functions provides you with in-depth training on Developer. Taught by Bill Weinman as part of the MySQL Essential Training show less
please wait ...

Aggregate functions

Aggregate functions are functions that operate on a set of rows rather than row by row. For example, we'll be using the world database. And we'll start with a simple example of an aggregate function that we're all familiar with the Count function. So, I'll select COUNT with an asterisk in the parenthesis. FROM the country table. And when I press go, you see there are 239 rows in the country table. So this returns one result for a number of rows.

There's 239 rows but there's only one result for the count. The asterisk is a special case for the count function that will count all the rows in a table. If instead, you specify a column. COUNT will count all the non-null values in that column. So if I put in here population, which I know has a view null values in it, you notice we get a smaller value; instead of 239 we get 232. And those are the non-null values in the population column.

The GROUP BY clause, I'll put an asterisk back in over here and we'll specify a group by may ...

Aggregate functions
Video duration: 5m 45s 4h 24m Beginner

Viewers:

Aggregate functions provides you with in-depth training on Developer. Taught by Bill Weinman as part of the MySQL Essential Training

Subject:
Developer
Software:
MySQL
Author:
please wait ...