What is CUBE and define its functioning

Its return all the combination total of group by result

Syntax:- select firstcol,secondcol,sun(thirdcol) from tablename group by firstcol,secondcol with cube order by firstcol.