Written Order and Processing Order Differ
SQL is written with SELECT first, but processing starts with FROM. An aggregate query proceeds through FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, and LIMIT.
Which clause is processed immediately before GROUP BY?