MySQL SQLLesson 22Free preview
MySQL AVG()
This lesson is part of MySQL · All levels
Summary
The AVG() function calculates the arithmetic mean of a numerical value on a column, e.g. the test value average or the price average. Remember, the value of NULL is not counted, so the denominator is the number of rows that have a value, not the total row of the table. For the resulting functionality, use ROUND() around the function AVG().
Key points
- AVG() calculates the number of values divided by the number of rows that have values
- The value of NULL is not counted nor is it named
- The result is often decimal so it can be wrapped.
- Can be used with GROUP BY for average per group
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.