31/77
\begin{frame}
  \frametitle{Null Values: Problems}

  \begin{goal}{}
    SQL uses a \textbf{three-valued logic: true, false, unknown}!\\
    Any comparison with \sql{null} yields the value \emph{unknown}.\\
    \remark{%
      For users accustomed to two-valued logic, the outcome is often surprising.
    }
  \end{goal}
  \medskip

  \begin{quiz}{\textwidth}{Which of these queries return rows with \sql{null} in column A?}
    \begin{enumerate}
      \item \sql{select * from R where A = 42}
      \item \sql{select * from R where not (A = 42)}
      \item \sql{select * from R where A = null}
    \end{enumerate}
  \end{quiz}
  \pause
  None of these queries does!
  
  \begin{goal}{}
    To get the rows with \sql{null} values, use \sql{... where A is null}.
  \end{goal}
  \pause\medskip
  
  \begin{alertblock}{}
    Some languages do not know about null values. \\
    \remark{%
      Explicit null value check and treatment required when reading attribute values into program variables.
      This complicates application programs.
    }
  \end{alertblock}
\end{frame}