Microsoft SQL Server SUM()


Example

Returns sum 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 SUM(MarksObtained) From Marksheet

The sum 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 sum calculation