13/212
\begin{frame}
  \frametitle{Concurrent Access: Inconsistent Read}
  
  Reconsider the \emph{transfer from checking to saving account}:
  \begin{exampleblock}{}
    \begin{tabular}{l|l}
      \emph{Transaction 1} & \emph{Transaction 2}\\
      \begin{code}{.49\textwidth}{}
        \footnotesize
        \nr{1}\sql{update Accounts}\\
        \nr{2}\sql{set\ \ \ \ balance = balance - 500}\\
        \nr{3}\sql{where\ \ customer = 1904}\\
        \nr{4}\sql{\ \ \ and\ account\_type = \textquotesingle{}Checking\textquotesingle{}}
      \end{code}  \\[-1ex]
      &
      \begin{code}{.42\textwidth}{}
        \footnotesize
        \nr{1}\sql{select sum(balance)}\\
        \nr{2}\sql{from\ \ \ Accounts}\\
        \nr{3}\sql{where\ \ customer = 1904}
      \end{code} \\[-1ex]
      \begin{code}{.49\textwidth}{}
        \footnotesize
        \nr{5}\sql{update Accounts}\\
        \nr{6}\sql{set\ \ \ \ balance = balance + 500}\\
        \nr{7}\sql{where\ \ customer = 1904}\\
        \nr{8}\sql{\ \ \ and account\_type = \textquotesingle{}Saving\textquotesingle{}}
      \end{code}      
    \end{tabular}
  \end{exampleblock}
  \pause
  
  \begin{alertblock}{}
    Transaction $2$ sees a temporary, \emph{inconsistent database state}.
  \end{alertblock}
  \pause
  
  \begin{goal}{}
    This is known as \emph{inconsistent read anomaly}.
  \end{goal}
\end{frame}