I’ve been a SQL user for many years, building all sorts of data warehousing solutions in various roles, and I occasionally end up trawling the net for some inspiration for a particularly challenging data transformation. At times like this I can stumble upon some amazingly SQL implementations for insane solutions. Here are a couple of my more recent finds.
Though I’ve been a fan of the Common Schema toolset (Link) the default ASCII graph it can generate is a bit dull, so I went looking for something new and found some code that can generate pie charts in ASCII art! Take a look at this website which is it’s home. It produces just magnificent pie charts as this one
+----------------------------------------------------------------------+ | pie_chart | +----------------------------------------------------------------------+ | | | ;;;;;;;;;;;;;;;;;;;;; | | oooooooo;;;;;;;;;;;;;;;;;;;;;;;;;;; | | oooooooooooooo;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | | ooooooooooooooooo ;;;;;;;;;;;;##### | | oooooooooooooo ;############# | | oooooooooooo ############ | | oooooooooooo ############ | | ooooooooooo ########### | | oooooooooooo :::::::::::: | | oooooooooooo :::::::::::: | | ooooooooo::::: :::::::::::::: | | o:::::::::::::::: ::::::::::::::::: | | ::::::::::::::::::::::::::::::::::::::::::::: | | ::::::::::::::::::::::::::::::::::: | | ::::::::::::::::::::: | | | | ## red: 1 (10%) | | ;; blue: 2 (20%) | | oo orange: 3 (30%) | | :: white: 4 (40%) | +----------------------------------------------------------------------+
The second wondrous bit of SQL is in fractal and chaos maths which is something I have a particular fondness of and something I wasn’t really looking for, but found this week by accident as it popped up on my security feed of all things. Take a look at this website for the SQL source.
.......................................................................................
.........................................................................................
...........................................................................................
....................................................,,,,,,,,,................................
................................................,,,,,,,,,,,,,,,,,,............................
..............................................,,,,,,,,,,,,,,,,,,,,,,,,.........................
............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.......................
..........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.....................
.........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................
........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..................
.......................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,................
.......................................,,,,,,,,,,,,,,,,,,,,,,,,--,,,,,,,,,,,,,,,,,,,,...............
......................................,,,,,,,,,,,,,,,,,,,,,,,,,,-+--,,,,,,,,,,,,,,,,,,,..............
....................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----,,,,,,,,,,,,,,,,,,,.............
...................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,--- -----,,,,,,,,,,,,,,,,,............
.................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---++--++,,,,,,,,,,,,,,,,,,...........
................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----%++---,,,,,,,,,,,,,,,,,...........
..............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%----,,,,,,,,,,,,,,,,,,..........
.............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----- %%+----,,,,,,,,,,,,,,,,,,.........
...........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---%-+% ----,,,,,,,,,,,,,,,,,,,........
..........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+ + # %+%---,,,,,,,,,,,,,,,,,,........
........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----# # +---,,,,,,,,,,,,,,,,,,.......
.......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------% %-----,,,,,,,,,,,,,,,,,.......
.....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------+ ------,,,,,,,,,,,,,,,,,......
....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----------+@ +-----------,,,,,,,,,,,,......
..................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----@-------++ ++-----------,,,,,,,,,,,,.....
.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--+@% ---+ +@%%@ %%+@+@%------+-,,,,,,,,,,,.....
................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---- # ++% % @-----++--,,,,,,,,,,,....
..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----+ % %%++ %+%@-,,,,,,,,,,,....
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+ % ++-,,,,,,,,,,,,...
............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,------+ @---,,,,,,,,,,,,...
..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------++% ---,,,,,,,,,,,,...
.........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+ + %+---,,,,,,,,,,,,,..
........,,,,,,,,,,,,,,,,,,,,,--------------------@ +----,,,,,,,,,,,,..
.......,,,,,,,,,,,,,,,,,,,,,,- +-----------------+ ----,,,,,,,,,,,,..
.......,,,,,,,,,,,,,,,,,,,,,--++------+---------+% +++--,,,,,,,,,,,,.
......,,,,,,,,,,,,,,,,,,,,,,--%+-----++--------- #+-,,,,,,,,,,,,.
.....,,,,,,,,,,,,,,,,,,,,,,----#%++--+@ -+-----+% --,,,,,,,,,,,,.
.....,,,,,,,,,,,,,,,,,,,,,,-----+## ++@ + +----% +--,,,,,,,,,,,,,.
....,,,,,,,,,,,,,,,,,,,,,,------+@ @ @@++++# +--,,,,,,,,,,,,,.
....,,,,,,,,,,,,,,,,,,,,,-------% #++% -,,,,,,,,,,,,,.
...,,,,,,,,,,,,,,,,,,,,,------++%# %%@ %-,,,,,,,,,,,,,,
...,,,,,,,,,,,,,,,,,,,--------+ % +--,,,,,,,,,,,,,,
...,,,,,,,,,,,,,,,,,,-----+--++@ # --,,,,,,,,,,,,,,
..,,,,,,,,,,,,,,,,,-------%+++% @--,,,,,,,,,,,,,,,
..,,,,,,,,,,,-------------+ @ @ ---,,,,,,,,,,,,,,,
..,,,,,,,,,---@--------@-+% +---,,,,,,,,,,,,,,,
..,,,,,------- +-++++-+%%% +----,,,,,,,,,,,,,,,
..,,,,,,------%--------++% +----,,,,,,,,,,,,,,,
..,,,,,,,,,,--+----------++# ---,,,,,,,,,,,,,,,
..,,,,,,,,,,,,------------+@@@% +--,,,,,,,,,,,,,,,
..,,,,,,,,,,,,,,,,,------- +++% %--,,,,,,,,,,,,,,,
...,,,,,,,,,,,,,,,,,,---------+@ @ --,,,,,,,,,,,,,,
...,,,,,,,,,,,,,,,,,,,,------- # %@ +--,,,,,,,,,,,,,,
...,,,,,,,,,,,,,,,,,,,,,-------++@ %+ %-,,,,,,,,,,,,,,
....,,,,,,,,,,,,,,,,,,,,,------- %++% %-,,,,,,,,,,,,,.
....,,,,,,,,,,,,,,,,,,,,,,------+# %# #@ ++++ +--,,,,,,,,,,,,,.
.....,,,,,,,,,,,,,,,,,,,,,,-----+ %%++% +@+----+ +--,,,,,,,,,,,,,.
.....,,,,,,,,,,,,,,,,,,,,,,,---%+++--+#+--------% #--,,,,,,,,,,,,.
......,,,,,,,,,,,,,,,,,,,,,,--++-----%%--------- @#--,,,,,,,,,,,,.
.......,,,,,,,,,,,,,,,,,,,,,---------------------+@ +-++,,,,,,,,,,,,..
........,,,,,,,,,,,,,,,,,,,,,--------------------+ ----,,,,,,,,,,,,..
.........,,,,,,,,,,,,,,,,,,,,----,,,------------- #+----,,,,,,,,,,,,..
..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------+ + +---,,,,,,,,,,,,,..
...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+%# #---,,,,,,,,,,,,...
............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,------+# @ @---,,,,,,,,,,,,...
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+# + @--,,,,,,,,,,,,...
..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+% %+@ %+-+ +++%-,,,,,,,,,,,....
................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----% %@++ # % -----++-,,,,,,,,,,,,....
.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-- ++ ---+ + +%@ %++++++------%-,,,,,,,,,,,.....
...................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---- -------++ +------------,,,,,,,,,,,,.....
....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----------+% +--------,,,,,,,,,,,,,,,......
......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+ -----,,,,,,,,,,,,,,,,,,......
.......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------+ ----,,,,,,,,,,,,,,,,,,.......
.........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----+% %#---,,,,,,,,,,,,,,,,,,,.......
..........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+%+%@ %+%%--,,,,,,,,,,,,,,,,,,........
............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+-+% %----,,,,,,,,,,,,,,,,,,.........
.............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%@+---,,,,,,,,,,,,,,,,,,,.........
...............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%----,,,,,,,,,,,,,,,,,,..........
................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----%+ +--,,,,,,,,,,,,,,,,,...........
..................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---++----,,,,,,,,,,,,,,,,,............
...................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,---@-----,,,,,,,,,,,,,,,,,............
.....................................,,,,,,,,,,,,,,,,,,,,,,,,,,,-----,,,,,,,,,,,,,,,,,,,.............
.....................................,,,,,,,,,,,,,,,,,,,,,,,,,,--%,,,,,,,,,,,,,,,,,,,,..............
.......................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,................
........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.................
........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..................
.........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................
..........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.....................
............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,.......................
.............................................,,,,,,,,,,,,,,,,,,,,,,,,.........................
................................................,,,,,,,,,,,,,,,,,............................
.....................................................,,,,...................................
...........................................................................................
.........................................................................................
......................................................................................
....................................................................................
.................................................................................
..............................................................................
...........................................................................
Both are pretty cool from a SQL point of view as its not just boring database stuff you can use it for. Why you would want to do this is another matter but you can! 😉
Kev
