Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Rollup Totals

Return total sales per region and product, plus a subtotal per region and a grand total (NULL marks the rolled-up level). Use GROUP BY ROLLUP or an equivalent UNION.

Table schema

Sales(region VARCHAR(20), product VARCHAR(20), amount INT)

Sample data

region | product | amount
East | Pen | 10
East | Book | 20
West | Pen | 5

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.