Think of the columns in the group by as buckets, any aggregation is then applied to each bucket;
ColAColB
A1
B2
A2
B3
Group by ColA -> Aggregation on B
A (1,2)
B (2,3)
or in other words, it defines the level of detail, in this case, the distinct values in ColA
😎