When a Group By is performed, the parser logically collects rows that have the same value for a specified column and then it groups them together. The following groups all publ_names together and return the sum of the number of publishers with that name.

Example 4-22. Using the GROUP BY Clause

   SELECT publ_name, COUNT(*)
     FROM publish
 GROUP BY publ_name;

    publ_name     | count
------------------+-------
 ABC Books        |     2
 Children's Books |     1
 ODG Books        |     1
 Reading Rainbow  |     1
 Young Readers    |     1
(5 rows)