ROLLUP is a SQL feature that helps you get subtotals and grand totals easily. When you group data by columns and add WITH ROLLUP, the database first groups rows normally. Then it adds extra rows that show subtotals for each group level by replacing the rightmost grouped columns with null. Finally, it adds a grand total row with all grouped columns as null. For example, grouping sales by category and product with ROLLUP will show sales per product, subtotals per category, and a grand total. Null values in grouped columns indicate subtotal or total rows. This makes reports easier to read and saves writing multiple queries.