SUM

SUM ([DISTINCT] expression)
  • DISTINCT - specifies to accumulate unique values only.
  • expression - may be a column name, the result of another function, or a math operation.

Returns a sum of all values. If no entries are selected, the result is NULL. Aggregates are only allowed in select statements. The data type of the returned value depends on the parameter data.

Get a total goals number scored by all players:

SELECT SUM(goal) FROM Players;

Updated about 5 years ago