O'Reilly logo

Joe Celko's SQL for Smarties, 4th Edition by Joe Celko

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

28

Grouping Operations

I am separating the partitions and grouping operations based on the idea that a group has group properties that we are trying to find, so we get a single row back for each group. A partition is simply a way of subsetting the original table, so we get a table back as a result.

28.1 GROUP BY Clause

The GROUP BY clause is based on simple partitions. A partition of a set divides the set into subsets such that (1) the union of the subsets returns the original set and (2) the intersection of the subsets is empty. Think of it as cutting up a pizza pie—each piece of pepperoni belongs to one and only one slice of pizza. When you get to the section on SQL-99 OLAP extensions, you will see “variation on a theme” in the ROLLUP and ...

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