- Overview
- Data types
- Commands
- Functions
- Overview
- Aggregate
- Conditional expression
- Conversion
- Date and time
- Numeric
- String
- Semi-structured data
On this page
|| (concat)
Returns a concatenation of two arrays.
The ||
operator provides alternative syntax for ARRAY_CONCAT and can concatenate more than two arrays.
Syntax
<array1> || <array2>
Arguments
<array1>
The source array.
<array2>
The array to be appended to <array1>
.
Returns
An ARRAY containing the elements from <array2>
appended after the elements of <array1>
.
If any input value is NULL, returns NULL.
Examples
This example shows how to use array_concat
:
SELECT [1, 2, 3] || [] || ["other", "solutions"];
+-------------------------------------------+
| [1, 2, 3] || [] || ['other', 'solutions'] |
+-------------------------------------------+
| [1,2,3,'other','solutions'] |
+-------------------------------------------+