Making art with SQL

ByMauro Pichiliani in

The SQL language has emerged to facilitate the manipulation of data and implement the main operations of relational algebra. In this post I will comment on something unusual that we can make using it: create art.


Over time several new features, extensions and modifications were added to the SQL language that currently goes far beyond the SELECT, INSERT, UPDATE and DELETE. One of the most interesting is the possibility of performing primitives graphical drawings such as points, lines, circles and so on.

These primitive drawings were created in a way that SQL can be used in conjunction with GIS solutions that manipulate maps, coordinates, location and other elements. The integration takes various forms, but some people have used the resources and graphic primitives to start making drawings.

The idea is quite simple: instead of a SELECT statement returns rows and columns, it will return a drawing. Usually there is a part or tab of a query tool that allows you to view this type of return data. The end result is pretty much like the ASCII Art.

The more used SGGBD to this type of design are SQL Server and PostgreSQL with PostGIS extension. Many people may turn up their noses and say it’s a waste of time, but I enjoy exploring this nifty use type, especially by the fact that many DBA and developers are used to see results only in relational format (rows and columns). See below for some examples of SQL Art:





For more information about creating your own drawings with SQL, I recommend a visit to the links below:

Leave a comment! 0

read more