Solve “Deduplicate events with ROW_NUMBER”

Free. Runs in your browser, no install.

SQL · Aggregations & Grouping

What is ROLLUP?

Mediumrollupsubtotalsgrouping

Interview question

What is ROLLUP?

How to answer

The short answer

ROLLUP generates subtotals and a grand total.

Example:

SQL
SELECT department, team, SUM(salary)
FROM employees
GROUP BY ROLLUP(department, team);

It can produce:

Useful for reports.

Lock it in with a real drill

You remember an answer longer once you have used it. Try a hands-on problem on this concept.

Open related drill