Skip to main content

Categories: Semi-Structured Data

ARRAY_DISTINCT

Given an input array, returns an equivalent array that includes only distinct elements.

Syntax

ARRAY_DISTINCT(input LIST) → LIST

  • input: The input array from which to return only distinct elements.

Examples

ARRAY_DISTINCT example
SELECT ARRAY_DISTINCT(ARRAY[1, 2, 3, 1, 2, 3])
-- [2, 3, 1]

Usage Notes

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