220/224
\begin{frame}
  \frametitle{Inner and Outer Joins}

  \begin{quiz}{\textwidth}{Is there a problem with the following query?}
    ``\emph{Number of homeworks solved per student (including 0).}''
  
    \bigskip
    \small
    \BUseVerbatim{query}
  \end{quiz}
  
  %% Yes:
  %% The outer join is constructed before the where clause is evaluated:
  %% for Students without any entry in Results, the attributes R.cat,
  %% R.eno, ... have been set to null before the test one R.cat = 'H'
  %% takes place.
  \smallskip\pause

  Correction:
  \begin{itemize}
    \item restrict the join inputs \emph{before} the outer join is performed, or
    \item \emph{move} restrictions into the \sql{on} clause (\alert{warning: next slide}).
  \end{itemize}  
  
  \begin{code}{\textwidth}{Corrected version of last query}
    \small
    \BUseVerbatim{query2}
  \end{code}
\end{frame}