SUM() aggregate function takes the name of a column as an argument and returns the sum of all the value in that column.
SELECT SUM(column_name)FROM table_name;
For instance, suppose there’s a
transactions table with the following values:
The given query will return the sum of all values from the
SELECT SUM(amount)FROM transactions;
The result would be:
Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.
- Anonymous contributors
Learn SQL on Codecademy
Analyze Data with SQLLearn to analyze data with SQL and prepare for technical interviews.
Includes 8 Courses
- Anonymous contributorsAnonymous contributors