\begin{frame}
\frametitle{The From Clause}
\begin{goal}{}
The \sql{from} clause can be understood as \emph{declaring
variables} that \emph{range over tuples} of a relation.
\end{goal}
\vspace{-1ex}
\begin{center}
\tableExercises
\end{center}
\begin{minipage}{.7\textwidth}
\begin{center}
\begin{code}{.9\textwidth}{}
\small
\BUseVerbatim{query}
\end{code}
\end{center}
\end{minipage}%
\begin{minipage}{.29\textwidth}
\begin{center}
\mpause[2]{
{\ttfamily\footnotesize
\colorbox{rellight}{%
\begin{tabular}[t]{|r|r|}
\multicolumn{2}{c}{Query Result} \\ \hline
\hd{number} & \hd{topic} \\ \hline
1 & Logic \\
2 & SQL \\
\hline
\end{tabular}%
}%
}
}
\end{center}
\end{minipage}
\pause\bigskip
The query may be thought of as\vspace{-0.5ex}
\begin{center}
\begin{code}{0.55\textwidth}{}
\footnotesize
\begin{algorithmic}
\FORALL{\emph{rows} $\sql{E} \in \sql{Exercises}$}
\IF{\sql{E.category = \textquotesingle{}homework\textquotesingle{}}}
\STATE \textbf{print} \; \sql{E.number, E.topic}
\ENDIF
\ENDFOR
\end{algorithmic}
\end{code}
\end{center}\vspace{-0.5ex}
\emph{Tuple variable} \sql{E} iterates over the rows of \sql{Exercises}.
\bigskip
\end{frame}