SQL provides a mechanism for grouping and filtering the results of queries that involve aggregate functions. The semantics are confusing, unintuitive, and outside the scope of this document. Snooze provides access to these features (for hardier programmers) via the #:group and #:having clauses:
The #:group clause is a list of #:what items by which results should be grouped. For example:
; (listof (list employer natural-number))
; The number of employees working for each employer.
( (select #:what (employer (count employee.id))
#:from ( employer
The #:having clause is like the #:where clause but eliminates groups from the query results.