O'Reilly logo

Sams Teach Yourself SQL by Arie D. Jones, Ron Plew, Ryan Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Sorting and Grouping Data

You have learned how to query the database and return data in an organized fashion. You have also learned how to sort data from a query. During this hour, you learn how to break returned data from a query into groups for improved readability.

The highlights of this hour include:

  • Why you would want to group data

  • The GROUP BY clause

  • Group value functions

  • The how and why of group functions

  • Grouping by columns

  • GROUP BY versus ORDER BY

  • The HAVING clause

Why Group Data?

Grouping data is the process of combining columns with duplicate values in a logical order. For example, a database might contain information about employees; many employees live in different cities, while some employees live in the same city. You might want ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required