Save up to $499! Grab all Python courses for$49 or all online courses we’ve ever launched for only \$169. Only Feb 11-16. Happy Valentine's!
Introduction
CUBE
Summary

## Instruction

Let’s get started. In principle, ROLLUP and CUBE are similar. The difference is that CUBE does not remove columns from the right to create grouping levels. Instead, it creates every possible grouping combination based on the columns inside its parentheses. Take a look:

SELECT
Location,
Gender,
Risk,
AVG(Age) AS AvgAge

Syntax-wise, we only replaced ROLLUP with CUBE. Let’s see what result we’ll get.