> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.firebolt.io/feedback

```json
{
  "path": "/reference-sql/functions-reference/aggregation/array-agg",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

> Reference material for ARRAY_AGG function

# ARRAY_AGG

Concatenates input values, including `NULL` values, into an array.

## Syntax

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
ARRAY_AGG(<expression>) [FILTER ([WHERE] <condition>)]
```

## Parameters

| Parameter      | Description                                                       | Supported input type |
| :------------- | :---------------------------------------------------------------- | :------------------- |
| `<expression>` | Expression of any type to be accumulated into an array.           | Any                  |
| `<condition>`  | An optional boolean expression to filter rows used in aggregation | `BOOL`               |

## Return Type

`ARRAY` of the same type as the input data. If there is no input data, `ARRAY_AGG` returns `NULL`.

## Example

For the following example, see the `player_information` table:

| nickname    | playerid |
| :---------- | :------- |
| stephen70   | 1        |
| burchdenise | 7        |
| sabrina21   | NULL     |

The following code example code selects the columns in the `player_information` table and returns the values in two arrays, `nicknames` and `playerids`:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT
  ARRAY_AGG(nickname) AS nicknames,
  ARRAY_AGG(playerid) AS playerids
FROM
	price_list;
```

**Returns**

`{'stephen70', 'burchdenise', 'sabrina21'}, {1, 7, NULL}`

The following code example shows that if a filter is added to the query which rejects all rows, `ARRAY_AGG` will return `NULL`:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT
  ARRAY_AGG(nickname) AS nicknames,
  ARRAY_AGG(playerid) AS playerids
FROM
	price_list
WHERE
  playerid = 42;
```

**Returns**

`NULL, NULL`
