Check out example codes for "sum sql". It will help you in understanding the concepts better.

Code Example 1

/* COUNT() is a function that takes on the name of a clomn as an argument
and counts the number of rows where the column is not null */

SELECT COUNT(column_name)
FROM table_name;

Code Example 2

SELECT SUM(column_name)

FROM table_name

WHERE condition;

Code Example 3

SELECT SUM(column_name)
FROM table_name
WHERE condition;

Code Example 4

SELECT COUNT(column_name)

FROM table_name

WHERE condition;

Code Example 5

SELECT AVG(column_name)

FROM table_name

WHERE condition;

Learn ReactJs, React Native from akashmittal.com