From the course: Querying Microsoft SQL Server 2019
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Aggregate functions - SQL Server Tutorial
From the course: Querying Microsoft SQL Server 2019
Aggregate functions
- [Instructor] Once you've bundled several rows together with a group by clause and a query, you can perform aggregate calculations against all of the rows that are in each group. Aggregate functions are most commonly used in select statements of a query to create additional columns that'll appear in the results. To use them, you write the name of the function and, inside a parenthesis, the data table column that you want to process. You will also almost always want to add an alias with the as keyword so that the results clearly identify what the values represent. So, what are the aggregate functions that are available in SQL Server? The most common is count. Count will return the number of items in a group, and since it doesn't matter what column you count, you can use the asterisk character inside of the parenthesis. By default, count will count everything, even duplicate values and null values. If you want to remove…