SUM

The function SUM returns the sum of numeric values of items in a group. Without a GROUP BY clause it will aggregate with all rows of the SELECT. If there is no not NULL value in a group then it return NULL.

SQL Syntax:
 
   SUM( expression )
Parameters:
 
  expression

A numeric expression without a aggregate function.

Return Type:
 
  Depends on the data type of the expression it can be INT, BIGINT, DOUBLE, DECIMAL( 38, x) or MONEY.

Examples:

  • SELECT SUM( price ) FROM mytable
  • SELECT SUM( price ) FROM mytable
  • SELECT SUM( price ) FROM mytable t GROUP BY t.name

see also:
SQL Aggregate Functions


100% pure Java DBMS
Mirror Site