\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).}''
  %% 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.
  It is generally wise to restrict the outer join inputs
  \emph{before} the outer join is performed (or move restrictions into the \sql{ON} clause).
  \begin{code}{\textwidth}{Corrected version of last query.}