\begin{frame} \frametitle{Exists} We can also use \sql{exists} without negation: \smallskip \begin{code}{\textwidth}{Who has submitted at least one homework?} \small \BUseVerbatim{query} \end{code} \begin{center} \tableSmall \colorbox{rellight}{% \begin{tabular}[t]{|r|r|r|} \multicolumn{3}{c}{Query Result} \\ \hline \hd{sid} & \hd{first} & \hd{last} \\ \hline 101 & George & Orwell \\ 102 & Elvis & Presley \\ 103 & Lisa & Simpson \\ \hline \end{tabular}% }% \end{center} \pause \begin{quiz}{\textwidth}{Can we reformulate the above without using \sql{exists}?} \vskip.75cm\ \end{quiz} %% Yes (semi-join): %% select distinct S.sid, first, last %% from Students S, Results R %% where S.sid = R.sid and R.cat = 'H' \end{frame}