Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

AVG

Example

Provide the mean value of the “Price” column within the “Products” table.

SELECT AVG(Price) AS AveragePrice FROM Products;

Definition and Usage

The AVG() function calculates the average value of an expression. 

Note: excluding NULL values from consideration.

Syntax

AVG(expression)

Parameter Values

Parameter

Description

expression

Necessary: A numerical value (which may be a field or a formula)

Technical Details

Works in: From MySQL 4.0

More Examples

Example

Retrieve the entries with prices exceeding the average price.

SELECT * FROM Products
WHERE Price > (SELECT AVG(Price) FROM Products);