Skip to main content

Categories: Semi-Structured Data

SET_UNION

Given two arrays, returns a single array that includes all of the elements in the given arrays, without duplicates.

Syntax

SET_UNION(array1 LIST, array2 LIST) → LIST

  • array1: The first input array to participate in the union.
  • array2: The second input array to participate in the union.

Examples

SET_UNION example
SELECT SET_UNION(ARRAY[1, 2, 2, 3], ARRAY[1, 3, 5]);
-- [2,3,5,1]
SET_UNION example
SELECT SET_UNION(ARRAY[1, 1, 2], ARRAY[3, 3, 4]);
-- [2,3,4,1]

Usage Notes

The elements in the returned array are not listed in any particular order.