Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
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);