Categories: Aggregate, Semi-Structured Data
ARRAY_AGG
Aggregates the provided expression into an array.
Syntax
ARRAY_AGG ( [ DISTINCT ] expression ) → array
- expression: An expression of any primitive type to aggregate into an array.
Examples
ARRAY_AGG exampleCREATE TABLE <catalog-name>.people (name) AS VALUES ('Bob'), ('Charlie'), ('Alice');
SELECT ARRAY_AGG(name) FROM <catalog-name>.people;
-- ['Bob', 'Charlie', 'Alice']