ARRAY_CONTAINS_ANY

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Checks whether there's any overlap between two arrays.

Syntax

array_contains_any(<array1>, <array2>)

Arguments

Required

  • <array1>: The first array to compare.
  • <array2>: The second array to compare.

Returns

Returns a boolean value (true or false) that indicates whether any element exists in both arrays.

Considerations

  • Both arrays must have compatible element types.
  • Returns false if either array is empty.

Examples

Check for Overlap

Check whether two arrays share any common elements.

SELECT array_contains_any(array[1, 2], array[2, 3]) AS has_overlap;

Returns true because both arrays contain the value 2.

Related Documentation