MySQL AVG() Function
Example
Return the average value for the "Price" column in the "Products" table:
SELECT AVG(Price) AS
AveragePrice FROM Products;
Try it Yourself »
Definition and Usage
The AVG() function returns the average value of an expression.
Syntax
AVG(expression)Parameter Values
| Parameter | Description |
|---|---|
| expression | Required. A numeric value (can be a field or a formula) |
Technical Details
| Works in: | MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23 |
|---|
More Examples
Example
Select the records that have a price above the average price:
SELECT * FROM Products
WHERE Price > (SELECT AVG(Price) FROM Products);
Try it Yourself »

