SELECT in ISO/IEC-standard SQL prescribes the following syntactical order for the sub-clauses: SELECT projection-expressions FROM sources WHERE predicate-expression GROUP BY key-expression HAVING predicate-expression ORDER BY ordering-expressions While the actual execution order is this: FROM sources WHERE predicate-expression GROUP BY value-expression HAVING value-expression SELECT projection-expressions ORDER BY ordering-expressions To novice users of SQL it becomes surprisingRead more