A simplified logical order is:
FROM / JOIN WHERE GROUP BY HAVING SELECT DISTINCT ORDER BY LIMIT
So although we write:
SELECT ... FROM ... WHERE ... GROUP BY ... HAVING ... ORDER BY ...
SQL logically processes FROM first.
Interview gotcha: the order you write clauses is not the order SQL runs them.