4 ms·
I was thinking the same thing. HAVING must be after SELECT. It doesn't really make sense otherwise.
by okonomiyaki3000 7y ago
I was thinking the same thing. HAVING must be after SELECT. It doesn't really make sense otherwise.
- faizshah 7y agoLong story short, relying on HAVING to run after SELECT is not a standard SQL behavior it is dependent on the implementation and what the optimizer thinks is best (more discussion below: https://news.ycombinator.com/item?id=21153870 https://news.ycombinator.com/item?id=21153870). The diagram in the OP is a pretty good general/semantic understanding of SQL execution order for writing queries.