\begin{frame} \frametitle{Nested Aggregations} \begin{goal}{} \emph{Nested aggregations} require a subquery in the \sql{from} clause. \end{goal} \medskip \begin{code}{\textwidth}{% What is the average number of homework points (excluding those Students who did not submit anything)?} \small \BUseVerbatim{query} \medskip \begin{center} \footnotesize\ttfamily \colorbox{rellight}{% \begin{tabular}{|r|r|} \multicolumn{2}{c}{X} \\ \hline \hd{sid} & \hd{homeworkPoints} \\ \hline 101 & 18 \\ 102 & 18 \\ 103 & 5 \\ \hline \end{tabular}% } \qquad \colorbox{rellight}{% \begin{tabular}{|r|} \hline \hd{avg(X.homeworkPoints) } \\ \hline 13.67 \\ \hline \end{tabular}% } \end{center} \end{code} \end{frame}