From the course: Microsoft SQL Server 2016: Query Data
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using aggregates - SQL Server Tutorial
From the course: Microsoft SQL Server 2016: Query Data
Using aggregates
- [Instructor] In this lesson, we're going to take a look at some of the aggregates available within transact SQL. Now, we're not going to cover all of the aggregates that are available, but we will focus on some of the more common ones that you might run across. The first one we'll take a look at is the COUNT function. And we can use this to determine the number of records that are in a table based on a specific set of criteria. The criteria gets put within the parentheses for the function itself. Let's look at the first one that we have. SELECT COUNT star from HumanResources.Employee. If we run this, we see that we get a result of 290 returned. We don't have a column name here because we didn't use column aliases. And all we're attempting to do is show how we can make use of the COUNT function, and by putting the asterisk in as the criteria or the parameter for that function, we return all of the rows in the table. So we get a count of all of the rows. We haven't done anything with…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.