\begin{frame} \frametitle{Recursive Relations} The correct way is to use a \emph{recursive relation}: \begin{center} \scalebox{.8}{ \begin{tikzpicture}[every edge/.style={link},d/.style={node distance=1cm}] \node[entity] (employee) {employee}; \node[attribute,at=(employee),d,shift={(200:2.5cm)}] (id) {\key{id}} edge (employee); \node[attribute,at=(employee),d,shift={(180:2.5cm)}] (name) {name} edge (employee); \node[attribute,at=(employee),d,shift={(160:2.5cm)}] (job) {job title} edge (employee); \node[attribute,at=(employee),d,shift={(110:1.5cm)}] (salary) {salary} edge (employee); \node[relationship] (supervises) at ($(employee) + (4cm,0cm)$) {supervises} edge[bend left=30] node [above,pos=.75] {$1\sldots *$} (employee) edge[bend right=30] node [below,pos=.75] {$0\sldots 1$} node [above,pos=.5,inner sep=0] {manager} (employee); \end{tikzpicture} } \end{center} \pause \begin{goal}{} A \emph{recursive relation} translates to a foreign key that refers to the same table. \end{goal} \centering{\small\ttfamily \colorbox{rellight}{% \begin{tabular}[t]{|r|r|r|r|r|} \multicolumn{5}{c}{Employee} \\ \hline \hd{\key{id}} & \hd{name} & \hd{jobTitle}& \hd{salary} & \hd{supervisedBy$\;\to\;$id} \\ \hline 1 & James & \ldots & \ldots & 2 \\ 2 & Harrison & \ldots & \ldots & null \\ \hline \end{tabular}% }} \pause \begin{goal}{} A \emph{recursive many-to-many relation} requires a separate table with two foreign keys to the parent table (the usual translation). \end{goal} \end{frame}