ARRAY_UNION

All functions > ARRAY > ARRAY_UNION

Returns the union of two arrays, eliminating duplicate elements.

Syntax

ARRAY_UNION(array1, array2)
sql

Arguments

ParameterTypeRequiredDescription
array1ARRAYBIGINTYesThe first input array
array2ARRAYBIGINTYesThe 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

Examples

Last update at: 2025/10/13 10:23:46