Skip to main content

ARRAY_APPEND

Introduced or updated: v1.2.762

Appends an element to the end of an array.

Syntax

ARRAY_APPEND(array, element)

Parameters

ParameterDescription
arrayThe source array to which the element will be appended.
elementThe element to append to the array.

Return Type

Array with the appended element.

Notes

This function works with both standard array types and variant array types.

Examples

Example 1: Appending to a Standard Array

SELECT ARRAY_APPEND([1, 2, 3], 4);

Result:

[1, 2, 3, 4]

Example 2: Appending to a Variant Array

SELECT ARRAY_APPEND(PARSE_JSON('[1, 2, 3]'), 4);

Result:

[1, 2, 3, 4]

Example 3: Appending Different Data Types

SELECT ARRAY_APPEND(['a', 'b'], 'c');

Result:

["a", "b", "c"]
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today