% Taken from https://tex.stackexchange.com/questions/180401/drawing-sql-tables/180421#180421

\documentclass[tikz,border=2mm, convert={outfile=\jobname.png}]{standalone}
 \usetikzlibrary{matrix,positioning,arrows.meta}
\begin{document}
\begin{tikzpicture}[
table/.style={matrix of nodes, nodes in empty cells, column sep=-\pgflinewidth, row sep=-\pgflinewidth, nodes={draw,anchor=center,minimum width=2cm,minimum height=2cm}, row 1/.style={nodes={minimum height=1cm}}}]

\matrix(Event) [table, label=above:Event] {
    id \\};

\matrix(User) [table, label=above:User, left=1cm of Event] {
    id & attended & likes & hates \\};


\draw[-{Turned Square[]}] (User-1-2.south)--++(0,-.75)-|([xshift=2mm]Event-1-1.south);
\draw[-{Turned Square[]}] (User-1-3.south)--++(0,-.5)-|(Event-1-1.south);
\draw[-{Turned Square[]}] (User-1-4.south)--++(0,-.25)-|([xshift=-2mm]Event-1-1.south);
\end{tikzpicture}

\begin{tikzpicture}[
table/.style={matrix of nodes, nodes in empty cells, column sep=-\pgflinewidth, row sep=-\pgflinewidth, nodes={draw,anchor=center,minimum width=1cm,minimum height=1cm}, row 1/.style={nodes={minimum height=1cm}}}]


\matrix(User) [table, label=left:User] {
  id \\};
\matrix(Attendance) [table, label=left:Attendance, above right=5mm of User] {
  id & userid & eventid \\};
\matrix(Review) [table, label=left:Review, below right=5mm of User] {
  id & userid & eventid & opinion  \\};


\matrix(Event) [table, label=right:Event, right=5cm of User] {
  id \\};

\draw[->] (Attendance-1-2.south)--++(0,-.75)|-([yshift=2mm]User-1-1.east);
\draw[->] (Review-1-2.north)--++(0,.75)|-([yshift=-2mm]User-1-1.east);

\draw[->] (Attendance-1-3.south)--++(0,-.75)|-([yshift=2mm]Event-1-1.west);
\draw[->] (Review-1-3.north)--++(0,.75)|-([yshift=-2mm]Event-1-1.west);
\end{tikzpicture}

\end{document}