Data summarizing is one of the most common scenarios for SQL use in business environments. It is also very important for developers, report creators, and information workers. SQL Server has several built-in aggregate functions, such as AVG, SU, and MIN, to perform summarizing data operations. Basically, those operations are taken using multiple values to produce a single (scalar) value (for example, the average function on a column with 10,000 values will always produce a single output):
Function |
Example |
Description |
MIN |
MIN (ListPrice) |
Finds the smallest value in a column |
MAX |
MAX (Grade) |
Finds the largest values in a column |
SUM |
SUM (TotalSales) |
Creates a sum of numeric values in a column (non-null) |
AVG |
AVG (Size) |
Creates an average of numeric values in a column (non-null) |
COUNT |
COUNT (OrderID) COUNT... |