Microsoft SQL Server AVG()


Example

Returns average of numeric values in a given column.

We have table as shown in figure that will be used to perform different aggregate functions. The table name is Marksheet.

enter image description here

Select AVG(MarksObtained) From Marksheet

The average function doesn't consider rows with NULL value in the field used as parameter

In the above example if we have another row like this:

106    Italian    NULL

This row will not be consider in average calculation