Using aggregate functions in SQL Server

Updated on     Kisan Patel

This tutorial will show you how to user aggregate functions like AVG, MIN, MAX, SUM etc in SQL Server?

As AVG, MIN, MAX, and SUM all these functions work on numeric data so we need to pass numeric data type of columns to these functions that returns a single value.

SELECT  SUM(Salary) TotalSalary,
		AVG(Salary) AverageSalary,
		MIN(Salary) LowestSalary,
		MAX(Salary) HighestSalary
FROM Employees

In above query, we are getting the sum of Salary, average of NetSalary, the lowest of the salary and highest of the salary

SQL Server

Leave a Reply