SQL queries don't start with SELECT

This insightful article appeared recently:


At first, its content about SQL may seem totally unrelated to text-editors and so it feels strange to discuss about it on this forum.

But in way I found that the core idea of this article resonates with one of Kakoune distinct departure from the raw vim philosophy. I’m talking about the inversion of operation→select to select→operation.

Now you might think: “You got it wrong! The article explicitly tells us that the SQL SELECT is not the first link of the query chain, but in Kakoune you have to make the selection first as you mentioned just above!”

So yeah, in a sense in may be confusing but here’s how I see it: The selection(s) (which are a bunch of coordinates) that we interact with in Kakoune buffers are more related to the FROM concept in SQL, than the SELECT concept.

When we craft the selections in Kakoune with movements (j, h keys…), the s key to refine them, the <a-k> key to filter them, we’re starting the pipeline. And then eventually the “side-effect” is the neutral operation “Show them on the screen”.
So SELECT is indeed a verb, and it’s at the end. Other verbs like delete d, yank y… also happen when the pipeline is finished.

As a conclusion, I’m glad that this article confirms a parallel between writing SQL pipelines and the order we smash keys in a text-editor.