CUBE+GROUP BY for Subtotals

We all have used GROUP BY, but do you know CUBE?

For example, if I have a table of user spending, I can get the subtotal of each user AND the total spend of all users combined, all within one table.

πŸ“Œ Syntax is here.
πšžπšœπšŽπš›_πš’πš, πš‚πš„π™Ό(πšœπš™πšŽπš—πš) πšŠπš–πš
π™΅πšπ™Ύπ™Ό πšžπšœπšŽπš›πšœ
π™Άπšπ™Ύπš„π™Ώ π™±πšˆ π™²πš„π™±π™΄(πšžπšœπšŽπš›_πš’πš)

This saves you the need to create separate queries for generating the total.

As usual, full example below!

Another similar function is ROLLUP. Can anyone explain the difference between ROLLUP and π˜Ύπ™π˜½π™€?