SELECT, WHERE and ORDER BY: Logical Query Processing Order, TOP and OFFSET/FETCH
SQL evaluates a query as FROM, WHERE, GROUP BY, HAVING, SELECT, DISTINCT, ORDER BY, TOP, which is why a SELECT alias is invisible in WHERE but visible in ORDER BY. We show the cost of SELECT * and DISTINCT, why order is not guaranteed without ORDER BY, TOP WITH TIES, how even adding an index changes a page when OFFSET/FETCH pagination lacks a tie-breaker, and keyset pagination.
8 Nov 2026
·
12 min
·
4