GROUP BY is not just a syntax requirement. It is a grain declaration. The selected dimensions define the result rows, and the aggregates summarize whatever rows arrived after FROM, JOIN, and WHERE. That makes grain the control knob for correctness. Before optimizing or styling a query, say the grain in business language, then verify that the joins preserve or intentionally change it.
Read the full lesson
Sign up free: one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in