ARRAY_CONTAINS_ANY

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Checks whether there’s any overlap between two arrays.

Syntax 

1ARRAY_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.

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

Returns true because both arrays contain the value 2.

Related Documentation 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!