# A closer look at STRING_AGG in BigQuery

Modern SQL engines have a wealth of aggregation functions.

Here's a quick example that makes use ofBigQuery STRING\_AGG.

What does it do?

It aggregates all the values in a grouping, joined by a separator of our choice, creating a string of those joined values.

We can of course choose to:

➡️ keep only distinct values, as well as  
➡️ order the values in the newly created string

so that, as in the below example, ("Card", "Cash") and ("Cash", "Card") both produce "Card~Cash", every time.

Any interesting aggregation function that you use in your SQL dialect?

![](https://miro.medium.com/v2/resize:fit:700/0*GWeGTGbUEPaEUToK align="left")

*Found it useful? Subscribe to my Analytics newsletter at* [***notjustsql.com***](http://notjustsql.com/)*.*
