ARRAY_AGG
Collects values from many rows into one array.
Syntax
ARRAY_AGG(<expression>)
ARRAY_AGG(<expression> ORDER BY <sort key>)
An aggregate function like STRING_AGG, but the result is an array rather than text: you can keep working with it like a list. The order of elements is set with ORDER BY right inside the brackets, and a single element is taken by its number: [1] is the first.