\begin{frame}[fragile]
\frametitle{Multiple Tables}
\begin{goal}{}
\emph{Query:}
PIDs of all people that have chatted with everyone in the persons table (except themselves).
\end{goal}
\begin{exampleblock}{SQL Query}
{\small
\begin{verbatim}SELECT Y.PID
FROM Person as Y
WHERE NOT EXISTS (
SELECT *
FROM Person as X
WHERE Y.PID != X.PID
AND NOT EXISTS (
SELECT *
FROM Chats as C
WHERE ( C.P1 = Y.PID AND C.P2 = X.PID )
OR ( C.P1 = X.PID AND C.P2 = Y.PID )
)
)\end{verbatim}%
}
\end{exampleblock}
There is no FORALL in SQL. Recall $\myall{x}{\phi(x)} \equiv \neg\myex{x}{\neg{\phi(x)}}$ !
\end{frame}