Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Concatenates two arrays into a single array.
Syntax
array_cat(<array1>, <array2>)
Arguments
Required
<array1>: The first array.<array2>: The second array to concatenate to the first.
Returns
Returns an array that contains all elements from both input arrays in order.
Considerations
- The resulting element type is non-nullable only if both input element types are non-nullable.
- Both arrays must have compatible element types, otherwise your SQL query will fail.
Examples
Concatenate Two Arrays
Combine two arrays.
SELECT array_cat(array[1, 2], array[3, 4]) AS result;
Returns array[1, 2, 3, 4], combining both arrays.
Concatenate with NULL Elements
Combine arrays where one contains NULL values.
SELECT array_cat(array[1, null], array[3, 4]) AS result;
Returns array[1, null, 3, 4]. The resulting element type is nullable when either input contains NULL.