The SQLite documentation has a wonderfully titled section "Outlandish Recursive Query Examples" [1], which includes computation of a Mandelbrot Set.
https://wiki.postgresql.org/wiki/Mandelbrot_set
"This SQL query (requires PostgreSQL 8.4) produces an ASCII-art image of the Mandelbrot set. It is written entirely in SQL:2008-conformant SQL."