ARRAY_UNION
All functions > ARRAY > ARRAY_UNION
Returns the union of two arrays, eliminating duplicate elements.
Syntax
ARRAY_UNION(array1, array2)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
array1 | ARRAYBIGINT | Yes | The first input array |
array2 | ARRAYBIGINT | Yes | The second input array |
Returns
An array containing all unique elements from both input arrays
Notes
- Combines all unique elements from both arrays
- Eliminates duplicate elements using set semantics
- Result is sorted lexicographically
- Works with arrays of any comparable type
- Empty arrays are handled gracefully