Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
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