Published May 5, 2021Updated Jul 26, 2022
Contribute to Docs
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:
- Anonymous contributorsAnonymous contributors
- Anonymous contributors
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn SQL on Codecademy
Analyze Data with SQLLearn to analyze data with SQL and prepare for technical interviews.
Includes 8 Courses