This page is part of the book SQL-99 Complete, Really, by Peter Gulutzan & Trudy Pelzer. The authors have graciously allowed us to reproduce the contents of the book here. Because the book is about the SQL-99 standard, the contents of this and other pages in the book may not directly apply to MariaDB. Use the navigation bar to navigate the book.

This chapter deals with three optional points of a SELECT statement: the GROUP BY clause, the set functions {AVG, COUNT, MAX, MIN, SUM, EVERY, ANY, SOME, GROUPING}, and the HAVING clause. Often these things appear together: the common factor is summaries, or amalgams, of Columns with groups, rather than with details. We group together where values are equal. For example, confronted with the detail list {Smith Smith Smith Jones Jones}, we could summarize it to be: "three Smiths, two Joneses". Such a summary is known in SQL as a grouped Table.