Step 1: Walk through the logical order SQL processes a query.
Conceptually, SQL first picks the rows from FROM and WHERE, then groups the surviving rows using GROUP BY, computing any aggregate values like COUNT or SUM for each group, and only after that does it decide which groups make it into the final result.
Step 2: Place HAVING correctly in that order.
HAVING is the clause that runs after grouping and aggregation are already done. It filters out entire groups based on a condition, often one involving an aggregate function, for example keeping only departments where COUNT(*) is greater than 5.
Step 3: Distinguish it from the similar sounding options.
Filtering individual rows before any grouping happens is the job of WHERE, not HAVING. Sorting the final result set is done by ORDER BY, and combining tables is done by JOIN, none of these describe HAVING's actual role.
Step 4: Conclude.
The specific purpose of HAVING is
\[ \boxed{\text{To filter groups based on a condition}} \]