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.
Grouping results with GROUP BY - SQL Server Tutorial
From the course: Microsoft SQL Server 2016: Query Data
Grouping results with GROUP BY
- [Instructor] In this lesson we're going to take a look at the Group By clause in Sequel Server. Grouping allows us to basically take the results that are returned from the database and coordinate them or group them, if you will, into some category. And in this case we'll take a look at a couple of samples that help explain how Group By works and show examples of why we might want to use that. So our first example we're going to use Group By to group the results that get returned from a table and in this case we're going to group by the city name. So we're returning the city name and we're actually going to group by the city name. Let's run this and see what happens. So you can see that indeed we have returned the city name from the address table. And by itself you're looking at this and thinking, well where does the grouping come into play? Why is it that it just seems like a normal result set that's returned? And in order to answer that question we have to take a look at the row…
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.