Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Checks whether a specified value is present in an array.
Syntax
array_contains(<array>, <value>)
Arguments
Required
<array>: The array to search.<value>: The search value.
Returns
Returns a boolean value (true or false) that indicates whether the value is present in the array.
Considerations
- The value must match the element type of the array.
- Comparison is exact and case-sensitive for strings.
Examples
Check for Existing Value
Check whether a value exists in an array.
SELECT array_contains(array[1, 3, 4], 3) AS contains_three;
Returns true because 3 is present in the array.
Check for Missing Value
Check whether a value is present in an array.
SELECT array_contains(array[1, 3, 4], 2) AS contains_two;
Returns false because 2 isn't present in the array.