\begin{frame} \frametitle{Joins} \begin{alertblock}{} It is almost always an \emph{error} if there are two tuples variables which are \emph{not linked} (directly or indirectly) via join conditions. \end{alertblock} \medskip\pause In this query, all three tuple variables are connected: \begin{tcenter} \begin{code}{\textwidth}{} \small \BUseVerbatim{query} \end{code} \end{tcenter} \medskip\pause The tuple variable are connected as follows: \begin{center} \begin{tikzpicture}[n/.style={circle,draw=black,fill=cblue!30,inner sep=.5mm}] \node (S) [n] {S}; \node (R) [n,right of=S,node distance=35mm] {R}; \node (E) [n,right of=R,node distance=55mm] {E}; \draw (S) to node [below,align=center] {\sql{S.sid = R.sid}} (R); \draw (R) to node [below,align=center] {\sql{R.category = E.category}\\\sql{and R.number = E.number}} (E); \end{tikzpicture}\vspace{-1ex} \end{center} \begin{goal}{} Typically (just like in this example), the conditions correspond to the \emph{foreign key relationships} between the tables. \end{goal} \bigskip \end{frame}