With the tkz-fct
package, use \tkzFct[<options>]{<function>}
, compile with --shell-escape
enabled, and I believe you need to have gnuplot
installed.

\documentclass[border=5mm]{standalone}
\usepackage{tkz-fct}
\begin{document}
\begin{tikzpicture}[scale = 0.5]
\tkzInit[xmax=5,ymax=5,xmin=-5,ymin=-5]
\tkzGrid
\tkzLabelX[orig=true,label options={font=\tiny}]
\tkzLabelY[orig=false,label options={font=\tiny}]
\tkzDrawX
\tkzDrawY
\tkzFct[domain=-5:0,black]{\x**2-4}
\tkzFct[domain=0:5,black]{2*\x-4}
\end{tikzpicture}
\end{document}
If you'd like a method that doesn't involve gnuplot
and shell-escape
, you could try pgfplots
:

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{tikzpicture}[scale = 0.5]
\begin{axis}[
xmin=-5.5,xmax=5.5,
ymin=-5.5,ymax=5.5,
axis lines=center,
xlabel=$x$,
ylabel=$y$,
grid,
xtick={-5,...,5},
ytick={-5,...,5},
ticklabel style={font=\tiny,fill=white}]
\addplot [black,domain=-5:0] {x^2-4};
\addplot [black,domain=0:5] {2*x-4};
\end{axis}
\end{tikzpicture}
\end{document}