# Aggregate Functions
__*The role of aggregate functions*__
__*GROUP_CONCAT function*__
+ Performs a summary operation on a set of records
+ returns a single record based on multiple records aggregated into the same group
+ Includes only non-null values in the results
+ Typical functions:
  + `COUNT([distinct] expression)`  
  + `MIN(expression)` , `MAX(expression)`  
  + `SUM([distinct] expression)` , `AVG([distinct] expression)`  
  + `GROUP_CONCAT([distinct] expression)`  
```8
tidb> SELECT group_concat(name), count(*), max(mass) FROM universe.planets;
+---------------------------------------------------------------------------------+----------+-----------+
| group_concat(name)                                                              | count(*) | max(mass) |
+---------------------------------------------------------------------------------+----------+-----------+
| Mercury,Venus,Earth,Mars,Jupiter,Saturn,Uranus,Neptune,Pluto,Proxima Centauri b |       10 |      1898 |
+---------------------------------------------------------------------------------+----------+-----------+
1 row in set (0.00 sec)

tidb> select @@group_concat_max_len;
+------------------------+
| @@group_concat_max_len |
+------------------------+
|                   ~!@1024@!~ |
+------------------------+
```

------------------------------------------------------------
- `COUNT()`  return the number of rows retrieved
- `COUNT(DISTINCT)`  return the number of different values
- `MAX()`  return the maximum
- `MIN()`  return the minimum
- `SUM()`  return and
- `AVG()`  return the average
- `GROUP_CONCAT()`  return a string of connections

- Note:
  - Aggregate function ignore NULL values by default unless otherwise stated.
  - If you use an aggregate function in a statement that does not include a GROUP BY clause, it is equivalent to grouping all rows.