SQL SUM Function - SQL Server Sum() Function
The SQL SUM() Function
- The SUM() function provides the sum total of a numerical column in a dataset or database, offering a straightforward method to aggregate numeric data.
Demo Database
- Below is a snippet from the Wikitechy table used in examples
![table -Wikitechy](https://wikitechy.com/cdn/tutorials/sql/table-wikitechy.jpg)
Syntax
SELECT SUM(column_name) FROM table_name;
- Determine the aggregate sum of all Mark entries within the OrderDetails table to obtain the total quantity of products ordered.
Example
SELECT SUM(Mark) FROM tbl_Wikitechy;
Output
![sql-sum-function](https://wikitechy.com/cdn/tutorials/sql/sql-sum-function.jpg)