\documentclass[10pt]{article}
\usepackage{pdbf}
\usepackage[a4paper]{geometry}

\dbSQLText{CREATE TABLE test(a int, b int, [attribute with space] int); INSERT INTO test VALUES(1, 1, 1); INSERT INTO test VALUES(2, 2, 4); INSERT INTO test VALUES(3, 3, 8); INSERT INTO test VALUES(4, 4, 16);}
%\dbSQLFile{somedb.sql}
%\dbSQLJDBC{jdbc:postgresql://localhost:5432/postgres}{postgres}{test}{testtable}%
%\dbCSVFile{result.csv}{test}

\begin{document}
\noindent
\sql{SELECT * FROM test;}\\[3pt]
The table ``test'' contains \dataText{SELECT COUNT(*) FROM test;} tuples.\\[3pt]
The following points are linked to the chart on the left side below: \dataText[linkTo=testname, linkSelector=2, linkLabel=Value at 2]{SELECT * FROM test WHERE a=2;}, \dataText[linkTo=testname, linkSelector=3, linkLabel=Value at 3]{SELECT * FROM test WHERE a=3;}.\\[3pt]
\chart[width=0.45\textwidth, height=0.3\textwidth, logscale=true, chartType=line, name=testname]{SELECT a, b, [attribute with space] FROM test;}
\chart[width=0.45\textwidth, height=0.3\textwidth, chartType=bar]{SELECT a, b, [attribute with space] FROM test;}\\[3pt]
{\fontfamily{phv} \tiny \selectfont
\noindent
Change the font before this line to Helvetica and fontsize to tiny.\\[3pt]
\chart[width=0.6\textwidth, height=0.25\textwidth, chartType=compareToBest]{SELECT b FROM test;}\\[3pt]
\multiplotChart[width=0.6\textwidth, height=0.5\textwidth, xCount=2, yCount=2, yValues={["b", "b*2"]}, xValues={["a <= 2", "a > 2"]}, topArr={["a smaller or equal 2", "a greater 2"]}, yFirst]{SELECT a,? FROM test WHERE ?;}\\[3pt]
\pivotTable[width=0.10\textwidth, height=0.15\textwidth, rows={["a"]}, aggregationattribute=b]{SELECT * FROM test;}
\dataTable[verticalLines=i, horizontalLinesHeader=b hh, horizontalLinesBody=i]{SELECT * FROM test;}\\[3pt]
}
\end{document}