That other kind of JOIN

dws on 2005-02-13T04:53:01

I've been doing database-related work for most of the last 15+ years, yet last week was only the second time I've needed to use a FULL OUTER JOIN in production code.

We use LEFT JOIN as an interview question to gauge a candidate's knowledge of SQL, but this was one of those "we may get some from here, we may get some from there, but we need to count either as one" situations (with a few twists) were a LEFT JOIN wasn't sufficient, and I didn't want to introduce additional queries into this particular piece of code. As Holmes would say, it was a "three pipe problem." Nailing it was the high point to an otherwise good week.


Three Pipes / Full Outter

n1vux on 2005-02-20T04:20:04

One does wonder whether the requirements are sensible when a FULL OUTTER JOIN is the correct answer, but I do understand the pleasure in finding the solution. About once a decade I use actual precondition/invariant/postcondition code-proof "in anger" because the loop isn't debuggable in practice. It feels good, but I wouldn't want to do it every day.