\begin{frame}
\frametitle{Keys are Contraints}
\begin{goal}{}
\textbf{Keys are constraints:}
they refer to all possible DB states, not only the current one.
\end{goal}
\begin{center}
\begin{code}{.6\textwidth}{}
\small
\BUseVerbatim{createtable}
\end{code}
\end{center}
\pause
\begin{exampleblock}{}
\centerline{%
\ttfamily\footnotesize
\colorbox{rellight}{%
\begin{tabular}[t]{|r|r|r|r|}
\multicolumn{4}{c}{Students} \\ \hline
\hd{\underline{sid}} & \hd{first} & \hd{last} & \hd{address} \\ \hline
101 & George & Orwell & \normalfont\ldots \\
103 & Lisa & Simpson & \normalfont\ldots \\
\hline
\end{tabular}%
}
}
\medskip
In this database state \sql{first} is a key for \sql{Students}.
However, this is too restrictive for all intended database states.
A future insertion of \sql{George Washington} would be impossible.
\end{exampleblock}
\pause
\begin{goal}{}
When declaring keys, think about all intended database states!
\end{goal}
\end{frame}