Skip to Content
Navigation:

A stick figure smiling

Here's a preview from my zine, Become a SELECT Star!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

Image of a comic. To read the full HTML alt text, click "read the transcript". get the zine!
read the transcript!

Conceptually, every step (like “WHERE”) of a query transforms its input, like this:

cats

owner: 1 name: daisy
owner: 1 name: dragonsnap
owner: 3 name: buttercup
owner: 4 name: rose

WHERE owner = 1

owner: 1 name: daisy
owner: 1 name: dragonsnap

The query’s steps don’t happen in the order they’re written: how the query’ is written SELECT…
FROM + JOIN
WHERE …
GROUP BY …
HAVING …
ORDER BY…
LIMIT…

how you should think about it:
FROM + JOIN ↓
WHERE

GROUP BY

HAVING

SELECT

ORDER BY

LIMIT

(In reality query execution is much more complicated than this. There are a lot of optimizations.)