SQL
Examples
Compute the average income along the provided four different dimensions:  
```sql
-- the syntax () denotes the empty set (i.e., computing an ungrouped aggregate)
SELECT city, street_name, avg(income)
FROM addresses
GROUP BY GROUPING SETS ((city, street_name), (city), (street_name), ());
```  
Compute the average income along the same dimensions:  
```sql
SELECT city, street_name, avg(income)
FROM addresses
GROUP BY CUBE (city, street_name);
```  
Compute the average income along the dimensions `(city, street_name)`, `(city)` and `()`:  
```sql
SELECT city, street_name, avg(income)
FROM addresses
GROUP BY ROLLUP (city, street_name);
```