skip to content
promptdojo
_
[ save your spot ]
[ follow on x ]
Select, filter, aggregate: the feature query shape — step 2 of 7
ch 36 · sql for ml datasets
2/7
promptdojo
_
›
phase 06 · ml systems
›
ch 36 · sql for ml datasets
lesson 1 of 4 · select, filter, aggregate: the feature query shape
step 2 of 7 in this lesson
You want "US users whose order total exceeds 20." Which clause does each condition belong in?
1
region='US' in WHERE (filters rows before grouping); total > 20 in HAVING (filters groups after)
2
Both in WHERE — HAVING is just WHERE's older syntax
3
Both in HAVING — aggregation queries can't use WHERE
4
region in GROUP BY, the total in ORDER BY
check
Show hint
ch 36 · sql for ml datasets
2/7
promptdojo
_
›
phase 06 · ml systems
›
ch 36 · sql for ml datasets
lesson 1 of 4 · select, filter, aggregate: the feature query shape
step 2 of 7 in this lesson
You want "US users whose order total exceeds 20." Which clause does each condition belong in?
1
region='US' in WHERE (filters rows before grouping); total > 20 in HAVING (filters groups after)
2
Both in WHERE — HAVING is just WHERE's older syntax
3
Both in HAVING — aggregation queries can't use WHERE
4
region in GROUP BY, the total in ORDER BY
check
Show hint
park a thought