SQL Server AVG() Function
THE WORLD'S LARGEST WEB DEVELOPER SITE

SQL Server AVG() Function

❮ SQL Server Functions

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: SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005

More Examples

Example

Select all the products that have a price above the average price:

SELECT * FROM Products
WHERE Price > (SELECT AVG(Price) FROM Products);
Try it Yourself »

❮ SQL Server Functions