# Drawing a database flowchart in Latex

I am working with a database and want to create a flow chart which shows how many cases are lost as I apply each filtering criteria. In short I want to generate an 'old school' flow chart as appears below. This link shows how to create colour pictures using \usepackage{smartdiagram}, however I want to create a very simple, straight-to-the-point chart. Are there premade packages for this, or must it be built using \usepackage{tikz}?

I suggest to use tikz.

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}%
[data/.style=
{draw,minimum height=0.7cm,minimum width=2cm,align=center},
filter/.style=
{draw,minimum height=1.3cm,minimum width=3cm,align=center},
database/.style=
{draw,minimum height=1.5cm,minimum width=3cm,align=center},
flow/.style={thick,-stealth},
apply/.style={}
]
\node[database] (db) {Database\\1995--2015};
\node[data,below=of db] (d1) {$N=4\,199$};
\node[data,below=of d1] (d2) {$N=2\,848$};
\node[data,below=of d2] (d3) {$N=2\,561$};
\draw[flow] (db) -- (d1);
\draw[flow] (d1) -- coordinate(d1d2) (d2);
\draw[flow] (d2) -- coordinate(d2d3) (d3);
\node[filter,right=of db] (excl) {Exclusions};
\node[filter] (f1) at (d1d2-|excl) {Males\\($N=250$)};
\draw[apply] (d1d2) -- (f1);
\node[filter] (f2) at (d2d3-|excl) {Not Obese\\($N=250$)};
\draw[apply] (d2d3) -- (f2);
\end{tikzpicture}

\end{document}

• Yes, I've done a few fairly simple flowcharts and just used TikZ. In fact they were my first TikZ figures -- it's a good place to learn the basics. – Chris H Jan 26 '17 at 11:34
• Awesome, thanks for a walk-through example – user08041991 Jan 26 '17 at 11:41