ROLLUP is not the same than groups. With
[1:a 1:b 2:a]
Group by (as is normaly in other langs): [1:[a,b] 2:[a]]
Sql "group by" instead is for summary/tally of data: [1:2 2:1] //assuming count
ROLLUP is for make a nice report! [1:[a,b] Count:2; 2:[a] Count:1]
What SQL lacks (in this case), but the relational model not, is the ability to nest relations as easily as JSON.----
Part of the deceptive power of SQL is that is very adequate and for "just query" of data is ok for most cases.
But as "programming language" it lacks some extra power and versatility.