Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

SUM

Example

Provide the total sum of the “Quantity” values from the “OrderDetails” table.

SELECT SUM(Quantity) AS TotalItemsOrdered FROM OrderDetails;

Definition and Usage

The SUM() function determines the total of a given set of values.

Note that any NULL values are disregarded.

Syntax

SUM(expression)

Parameter Values

Parameter

Description

expression

Mandatory: A field or an equation

Technical Details

Works in:

 From MySQL version 4.0