199/224
\begin{frame}
  \frametitle{Sorting Output}
  
  \smallskip
  
  \begin{code}{0.95\textwidth}{%
      \raggedright
      Homework Results sorted by exercise (best result first).  In
      case of a tie, sort alphabetically by student name.
    }
    \small
    \BUseVerbatim{query}
  \end{code}
  
  \begin{itemize}
  \pause
  \item First, compare \sql{R.number}.
  \pause
  \item If the first criterion leads to a tie,
        compare \sql{points \textbf{desc}}.
  \pause
  \item If we still have a tie, compare \sql{S.last}.
  \pause
  \item If we still have a tie, compare \sql{S.first}.
  \end{itemize}
  \pause
  
  \begin{exampleblock}{}
    \begin{tcenter}
    \colorbox{rellight}{%
      \footnotesize\ttfamily
      \begin{tabular}[t]{|r|r|r|r|}
        \hline
        \hd{number} & \hd{points} & \hd{first} & \hd{last} \\ \hline
        1 & 10 & George & Orwell \\ 
        1 & 9 & Elvis & Presley \\ 
        1 & 5 & Lisa & Simpson \\ 
        2 & 9 & Elvis & Presley \\ 
        2 & 8 & George & Orwell \\
        \hline
      \end{tabular}%
    }%
    \end{tcenter}
  \end{exampleblock}
\end{frame}