35/214
\begin{frame}
  \frametitle{Query Formulation}
  
  \begin{tcenter}
  \begin{code}{\textwidth}{}
    \small
    \sql{SELECT  DISTINCT E.TOPIC}\\
    \sql{FROM STUDENTS S, EXERCISES E}\\
    \sql{WHERE S.FIRST = \textquotesingle{}Ann\textquotesingle{} AND S.LAST = \textquotesingle{}Smith\textquotesingle{}}
  \end{code}
  \end{tcenter}  
  \medskip\pause
  
  \begin{alertblock}{}
    Note: \sql{S} and \sql{E} are still \emph{unconnected}:
  \end{alertblock}
  \pause
  \begin{itemize}
  \item The \emph{connection graph} of the tables in a database schema
    (connections are foreign key relations)
    helps in understanding the connection requirements:
    \begin{talign}
    \xymatrix@C=2cm{%
      *+[F]{\sql{STUDENTS}} \ar@{-}[r] &
      *+[F]{\sql{RESULTS}}  \ar@{-}[r] &
      *+[F]{\sql{EXERCISES}}
    }
    \end{talign}\vspace{-2ex}
  \myexample
  \pause

  \item 
    We see that the \sql{S}--\sql{E} connection is \emph{indirect} 
    and needs to be established via a tuple variable \sql{R} over \sql{RESULTS}:
  \end{itemize}
  \pause
  \begin{code}{\textwidth}{}
    \small\centering
    \sql{S.SID = R.SID AND R.CAT = E.CAT AND R.ENO = E.ENO}
  \end{code}
\end{frame}