O'Reilly logo

The Language of SQL, Second Edition by Larry Rockoff

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

9. Summarizing Data

Keywords Introduced

DISTINCT  •  SUM  •  AVG  •  MIN  •  MAX  •  COUNT  •  GROUP BY  •  HAVING  •  ROW_NUMBER  •  RANK  •  DENSE RANK  •  NTILE  •  OVER  •  PARTITION BY

Up until now, all of the calculations, functions, and CASE expressions we’ve used have only altered the values of individual columns. The rows we’ve retrieved have corresponded to rows in tables in the underlying database. We now want to turn to various methods of summarizing data, by combining values in multiple rows.

The computer term usually associated with this type of endeavor is aggregation, which means “to combine into groups.” The ability to aggregate and summarize data is key to being able to move beyond a mere display of data to something approaching ...

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