SQL SUM() Function

The SUM() Function

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

SQL SUM() Syntax

SELECT SUM(column_name) FROM table_name;

SQL SUM() Example

The following SQL statement finds the sum of all the “Quantity” fields for the “OrderDetails” table:

Example

SELECT SUM(Quantity) AS TotalItemsOrdered FROM OrderDetails;

No comments yet.

Leave a Reply

*