\begin{frame} \frametitle{Other Constraints} \begin{exampleblock}{Multiple choice test} The following relation stores the solutions to a typical multiple choice test: \centering\footnotesize\ttfamily \colorbox{rellight}{% \begin{tabular}{|r|r|r|r|} \multicolumn{4}{c}{Answers} \\ \hline \hd{\underline{question}} & \hd{\underline{answer}} & \hd{text} & \hd{correct} \\ \hline 1 & a & ... & Y \\ 1 & b & ... & N \\ 1 & c & ... & N \\ 2 & a & ... & N \\ 2 & b & ... & Y \\ 2 & c & ... & N \\ \hline \end{tabular}% } \end{exampleblock} \medskip \begin{quiz}{\textwidth}{Using keys to enforce other constraints} The following is not an FD, MVD, or JD: \begin{tcenter} ``\textit{Each question can only have one correct answer.}'' \end{tcenter} Can you suggest a transformation of table \sql{Answers} such that the above constraint is already implied by a key? \end{quiz} %% Split ANSWERS vertically into %% CORRECT_ANSWERS(QUESTION,ANSWER,TEXT) key: QUESTION %% and %% WRONG_ANSWERS(QUESTION,ANSWER,TEXT) key: QUESTION,ANSWER %% %% The key in CORRECT_ANSWERS ensures that only one entry is made for %% each question (multiple wrong answers may be recorded in %% WRONG_ANSWERS). %% %% New inter-relational constraint needed: same question with same %% answer may not appear in both tables \end{frame}