Categories:

Semi-structured Data Functions (Array/Object)

ARRAY_CONTAINS

Returns True if the specified variant is found in the specified array.

Syntax

ARRAY_CONTAINS( <variant> , <array> )

Usage Notes

  • Takes a VARIANT and an ARRAY value as inputs and returns True if the VARIANT is contained in the ARRAY.

Examples

The following queries demonstrate basic usage of the ARRAY_CONTAINS function:

SELECT ARRAY_CONTAINS('hello'::variant, array_construct('hello', 'hi'));
+------------------------------------------------------------------+
| ARRAY_CONTAINS('HELLO'::VARIANT, ARRAY_CONSTRUCT('HELLO', 'HI')) |
|------------------------------------------------------------------|
| True                                                             |
+------------------------------------------------------------------+
SELECT ARRAY_CONTAINS('hello'::variant, array_construct('hola', 'bonjour'));
+----------------------------------------------------------------------+
| ARRAY_CONTAINS('HELLO'::VARIANT, ARRAY_CONSTRUCT('HOLA', 'BONJOUR')) |
|----------------------------------------------------------------------|
| False                                                                |
+----------------------------------------------------------------------+