\begin{frame}
\frametitle{Having}
\begin{alertblock}{}
Aggregations may not be used in the \sql{where} clause.
\end{alertblock}
\medskip
With \sql{group by}, however, it makes sense to
\emph{filter out entire groups} based on some aggregated group
property.
\pause
\begin{goal}{}
This is possible with SQL's \sql{having} clause.
\end{goal}
\begin{code}{\textwidth}{}
For example, only groups of size greater than $n$ tuples.
\medskip
\small
\BUseVerbatim{query}
\end{code}
\begin{alertblock}{}
The condition in the \sql{having} clause may (only) involve
aggregation functions. % and the \sql{group by} attributes.
\end{alertblock}
\end{frame}