SQL SUM Function

Example

Return the sum of the “Quantity” field in the “OrderDetails” table:

SELECT SUM(Quantity) AS TotalItemsOrdered FROM OrderDetails;

Definition and Usage

The SUM() function calculates the sum of a set of values.

Note: NULL values are ignored.

Syntax

SUM(expression)

Continue reading SQL SUM Function

SQL SUM() Function

The SQL SUM() Function

The SUM() function returns the total sum of a numeric column.

Example

Return the sum of all Quantity fields in the OrderDetails table:

SELECT SUM(Quantity)
FROM OrderDetails;

Continue reading SQL SUM() Function