So i found the question Make an Example and shaded box like in the book which fitted to my desires.
I modified the box and counter so it fits to my whishes. (first number is the chapter second number is the example numbe. Is this chapterwise?!)
%example Box
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{xcolor}
% EXAMPLES
%% set the counter for your environment
\newcounter{example}
\renewcommand{\theexample}{\thechapter.\arabic{example}}
%% set up the examplebox
\newmdenv[%
backgroundcolor=black!2,
linecolor=black,
outerlinewidth=1pt,
roundcorner=2mm,
skipabove=\baselineskip,
skipbelow=\baselineskip,
settings={\global\refstepcounter{example}},
frametitlefont={\bfseries Beispiel~\theexample\quad},
]{example}
With the simple usage of:
\begin{example}[frametitle=Wie wird ein Ausführungsgraph erstellt]
select * from database where name='somename' and age>10
\end{example}
The question now is how i can get some kind of list of examples like list of figures? Moreover maybe some way to autolabel it?
\newlistof
command in the tocloft package.