Skip to content

array_concat, ||

Returns a concatenation of two arrays.

The || operator provides alternative syntax for ARRAY_CONCAT and can concatenate more than two arrays.

array_concat( <array1> , <array2> )

The source array.

The array to be appended to <array1>.

An ARRAY containing the elements from <array2> appended after the elements of <array1>.

If any input value is NULL, returns NULL.

This example shows how to use array_concat:

VALUES ([1, 2], [3, 4])
SELECT array_concat([1, 2], [3, 4]);
+------------------------------+
| array_concat([1, 2], [3, 4]) |
+------------------------------+
| [1,2,3,4] |
+------------------------------+

Use the || concatenation operator instead of the function:

SELECT [1, 2, 3] || [] || ["other", "solutions"];
+-------------------------------------------+
| [1, 2, 3] || [] || ['other', 'solutions'] |
+-------------------------------------------+
| [1,2,3,'other','solutions'] |
+-------------------------------------------+
ScopeDB Logo ScopeDB
© 2025 ScopeDB. All rights reserved.