You write SELECT first. SQL runs it fifth.
The hidden order your database uses to run every query, and why it explains your most confusing errors.
Every SQL query runs in two different orders.
The one you wrote. And the one your database actually uses to run it.
That’s it. Strip away the syntax, and that’s what’s happening underneath: the clauses you typed top to bottom get quietly reshuffled into a completely different sequence before a single row is touched.
Most people learn to write SQL. Almost n…


