Non-Brand Data

Non-Brand Data

Module 5: Counting the right thing with GROUP BY

Let's learn how `GROUP BY` changes the result and why `COUNT(*)` doesn't always count the thing we need.

Cornellius Yudha Wijaya's avatar
Cornellius Yudha Wijaya
Sep 20, 2026
∙ Paid

GROUP BY combines rows that have the same value and returns one result row for each group. We often use it with COUNT, SUM, or AVG to calculate a metric for each category.

The query itself is usually short, but there are two things we need to check. First, what does one row in the source table represent? Second, what should one row in the result represent?

In this module, we’ll compare item rows, orders, and customers. After that, we’ll change the grouping columns to produce one row per month instead of one row per month and status.

Share


User's avatar

Continue reading this post for free, courtesy of Cornellius Yudha Wijaya.

Or purchase a paid subscription.
© 2026 Cornellius Yudha Wijaya · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture