SUM is an aggregate function that calculates the total of non-NULL numeric values in a column or expression.
Total values are fundamental to sales, revenue, expenses, salaries, transactions, and financial analysis.
Calculate total sales amount.
SELECT
SUM(SalesAmount) AS TotalSales
FROM Sales;
SUM is widely used in financial reports, sales analysis, revenue calculations, expense analysis, and business dashboards.
- SUM calculates totals.
- It works with numeric expressions.
- NULL values are generally ignored.
- It can be combined with GROUP BY.
- It is commonly used for financial analysis.
What does SUM do?
SUM calculates the total of non-NULL numeric values.
Can SUM be used with GROUP BY?
Yes. SUM is commonly used with GROUP BY to calculate totals for each category.