MariaDB SUM function is used to return the summed value of an expression.
If the table has no any rows, then SUM () returns NULL. The DISTINCT keyword is also used with SUM () to sum only the distinct values of an expression.
Syntax:
SELECT SUM(aggregate_expression)
FROM tables
[WHERE conditions];