Group and Summarize Archives

When you group and summarize SQL results, you use the GROUP BY Clause to output a row across specified column values.  It is typically used in conjunction with aggregate functions such as SUM or Count to summarize values.  In SQL, groups are unique combinations of fields.  Rather than returning every row in a table, when values are grouped, only the unique combinations are returned.

If you want to start to learn about grouping data, I would recommend first reading this article:  How to Use GROUP BY to Summarize Query Results

Once you understand how to group and summarize data, I would recommend reading the following:

These article will help you understand the subtle, yet important differences between these commands.

All the examples for this lesson are based on Microsoft SQL Server Management Studio and the sample databases AdventureWorks and WideWorldImporters.  You can get started using these free tools using my guide Getting Started Using SQL Server

13

What is the difference between WHERE and HAVING clauses?

In this article learn when to use WHERE and HAVING.  Both perform similar functions, but for different purposes! All the examples for this article are based on Microsoft SQL Server Management Studio and the AdventureWorks2012 database.  You can get started using these free tools using my Guide Getting Started Using SQL Server. How do Where and Having Differ? […]

Continue reading
>