Aggregate function. Calculate the average value from a set of numbers. NULL values are ignored. If no values can be averaged, this function returns NULL.


AVG ( [DISTINCT] expression )


  • DISTINCT: optional keyword. If present, will average the unique values.

  • expression: any numerical expression. This may be a column name, the result of another function, or a math operation

Return Type

A double if the input type is double, otherwise decimal.


SELECT AVG(table_rows) FROM information_schema.tables;
| AVG(table_rows) |
|       1540.0000 |
1 row in set (2.87 sec)

SELECT AVG(list_price * discount) FROM items;

SELECT AVG(age) FROM employees GROUP BY job_title;