# append

[Read this page in HTML](https://www.scopedb.io/docs/reference/functions/semi-structured-data/append)

Appends one element to an array.

## Syntax

```scopeql
append(<array>, <value>)
```

## Arguments

| Argument  | Type     | Description                                                                                    |
| --------- | -------- | ---------------------------------------------------------------------------------------------- |
| `<array>` | `array`  | Source array.                                                                                  |
| `<value>` | Any type | Element to append. Its type may differ from existing elements; NULL is appended as an element. |

## Returns

Returns `array`. Returns NULL if `<array>` is NULL.

## Examples

Append a new label to each event while keeping its existing labels in order.

```scopeql
VALUES ('evt-17', ['checkout', 'timeout']), ('evt-42', [])
SELECT $0 AS event_id, $1 AS labels
SELECT event_id, append(labels, 'reviewed') AS labels
```

```text
+----------+-----------------------------------+
| event_id | labels                            |
+----------+-----------------------------------+
| evt-17   | ["checkout","timeout","reviewed"] |
| evt-42   | ["reviewed"]                      |
+----------+-----------------------------------+
```

The expression returns a new array. Use `dedup` as a separate step if a label must appear only once.
