Final answer:
The WHERE clause is always evaluated first in a SELECT statement that contains WHERE, GROUP BY, and HAVING clauses. It filters rows based on a specified condition before any grouping or group filtering occurs.
Step-by-step explanation:
When a SELECT statement contains WHERE, GROUP BY, and HAVING clauses, the clause that is always evaluated first is the WHERE clause. The correct order of execution for these clauses in SQL is:
- WHERE clause: Filters rows based on a specified condition.
- GROUP BY clause: Groups the remaining rows after the WHERE filter into summary rows.
- HAVING clause: Filters groups based on a specified condition, typically involving aggregated data.
The SELECT clause itself is not a filtering clause but is used to specify the columns that should be returned in the query's result set.