Track · 2:32 · Liner note

Where the Cursor Rests

Writing a good query is an iterative process of starting small, checking the result and adding one clause at a time.

Good queries start small. Select a few columns, limit the rows, look at the result, then add the next clause. Where the Cursor Rests is the pause in that loop, the place in the editor where you stop typing and read what the last run told you before deciding where to go.

Build in layers: one CTE per idea, names that say what they hold, row counts checked at each step. Resist the urge to write the whole statement in one go. A query grown this way can be explained line by line to the next person.