SQL queries don't start with SELECT ↦
Yesterday I was working on an explanation of window functions, and I found myself googling “can you filter based on the result of a window function”. As in – can you filter the result of a window function in a WHERE or HAVING or something?
Eventually I concluded “window functions must run after WHERE and GROUP BY happen, so you can’t do it”. But this led me to a bigger question – what order do SQL queries actually run in?
Kind of a snappy headline because Julia is talking about order in terms of execution and most of the time we’re thinking about order in terms of authoring. But still, TIL!
Sign in or Join to comment or subscribe