Working with T-SQL function AVG ()


This article will explain SQL Server average function, AVG(), and its use cases. Many times, we need to find the average value of numeric data stored in a column to address our distinct business requirements. SQL Server offers an aggregate function, AVG() to get the average value of the specified expression in its statement. This logic behind getting the average value using this function is first add all values and then divide the sum by the total number of values.

Syntax

Here is the syntax of the AVG() SQL function:

–Syntax AVG ([ALL| DISTINCT] expression)

Here are the meanings for