DP-600 · 2.3.2 · Prepare data
T-SQL analytical flow
Select, filter, and aggregate data by using SQL
Understand the logical order of WHERE, , HAVING, , and to place filters correctly.
The core idea

Analytical follows a logical order. WHERE removes rows before groups exist. creates aggregates, then HAVING filters those groups.
add values without collapsing rows. In Fabric, lets you filter by those window-function results without wrapping the query in another subquery.
Most exam errors come from using the right condition in the wrong clause.
Key points
- WHERE: filters rows before grouping
- : collapses rows into groups
- HAVING: filters groups after
- : filters results of
Click an underlined term for a one-line explanation, or see them all in the glossary .
Exam trap
Filtering on an aggregate or on a in WHERE fails, because WHERE runs before grouping and before window functions. Use HAVING for groups and for window results.
Sources · 3 Microsoft Learn pages Show ▾
Checked on October 4, 2026. Report a problem
Go deeper on Microsoft Learn
Checked against Microsoft Learn on October 4, 2026. Report a problem with this card