SQL
Examples
Count the number of entries in the `addresses` table that belong to each different city:  
```sql
SELECT city, count(*)
FROM addresses
GROUP BY city;
```  
Compute the average income per city per street_name:  
```sql
SELECT city, street_name, avg(income)
FROM addresses
GROUP BY city, street_name;
```  
#### `GROUP BY ALL` Examples {#docs:sql:query_syntax:groupby::group-by-all-examples}  
Group by city and street_name to remove any duplicate values:  
```sql
SELECT city, street_name
FROM addresses
GROUP BY ALL;
```  
Compute the average income per city per street_name. Since income is wrapped in an aggregate function, do not include it in the `GROUP BY`:  
```sql
SELECT city, street_name, avg(income)
FROM addresses
GROUP BY ALL;
-- GROUP BY city, street_name:
```