top of page

Calculating the Median in SQL Server - Consider This Hacker Rank Problem
A median is defined as a number separating the higher half of a data set from the lower half. Query the median of the Northern Latitudes...
Feb 221 min read


Hackerrank - Calculating Leaf, Inner and Root Nodes in a Tree with SQL
Binary Trees make up a large part of computer science, but in this case, it is a simple SQL question asked by our friends at hackerrank....
Feb 202 min read


Factorial Digit Sum
Consider the number 100! That is the product of all of the numbers between 1 and 100. That is to say, 1 x 2 x 3 ... x100. Project Euler...
Jan 91 min read


Ever wondered if your password is strong enough? Consider this password strength checker written in python!
Consider the password: terry Seems weak, but how do we know? Running the code at the bottom of the page - if we input the term terry we...
Jan 31 min read


Identifying the only human readable file in a Linux folder - Over the wire Bandit level 4 - 5 password revealed
The over the wire Capture the Flag games are a great way to sharpen your command line linux skills. To obtain the password to level 5 the...
Dec 27, 20241 min read


A bit of Python for Project Euler
Project Euler is a series of mathematical questions that need the accompaniment of computer programming to solve. It is permissible to...
Nov 2, 20241 min read


Date Chaos – Creating a viable date dimension table from any table that you have in the database
Would you like to know how many Tuesdays are in 2024 and 2025 using a random table from the Adventureworks Database? No? Me neither. But...
Jul 31, 20241 min read


No ERD?! No worries! Deriving the output code of a report table from the Information Schema
We’ve all been there. You turn up to work and your manager says you need to generate some reports from so-and-sos database. Cool, no...
Jun 30, 20241 min read


The Difference Between an INNER JOIN and a CROSS APPLY
Friday night football, Wests Tigers are in front and your wife reminds you that you are going to see the in-laws. Sometimes it’s...
Jun 21, 20241 min read


Writing messages in spatial data in SQL? Is this possible? Yes! Is it worth it? No
Are you sick of writing cards for your spouse on a special occasion? Would you like to do something a little more meaningful? If you...
Jun 18, 20241 min read


Capture the Flag – SQL Style
Capture the Flag is native to the area of cybersecurity. The thrill of writing the correct linux command to retrieve the password in CTF...
Jun 14, 20242 min read


Don’t Make DeDuplicating Dastardly Difficult – A devious demystification of the dreaded duplicate
Hey Lucas, Yes boss? Can you tell me which tables have duplicates in the Sales schema in the Adventures Works database by lunchtime? But...
Jun 11, 20241 min read


HITMAN: Agent 47 I want you find every available weapon on all of the maps in 5 minutes: JSON query, cross apply and string manipulation
Anybody who knows me know that I am a HITMAN enthusiast. I love that the fact that it is a cerebral game. Sneaking around, trying to...
Jun 8, 20241 min read


Generating Create Table statements without using the Right-Mouse Button – crazy application of the string_agg function (for no reason)
Your manager walks in and says to you, I need you to create a shell of all tables that reside in our Microsoft SQL Server by lunchtime....
Jun 6, 20241 min read


Exam stress and windowed functions - A devious derivation of the daring use of dense_rank (and other windowed functions) - SQL for no reason
As you walk into the exam room, the hp envy is ominously sitting there, waiting to be programmed. You know you’re in for a doozy of a...
Jun 4, 20242 min read

The World of Dynamic Pivoting – in SQL Server
Times are changing, databases are getting more sophisticated and there are in-built functions that previous DBAs had to solve for...
Jun 3, 20242 min read


Welcome to The World of Obscure Uses of Code and SQL – First Stop – Solving the Synoptic Gospel Issue with Transact-SQL
Today we are looking to solve the problem of the synoptic gospels with SQL. Is this possible? Will we get anywhere? Probably not. But...
Jun 3, 20242 min read
bottom of page