> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ARRAY_CONTAINS

> Returns TRUE when the array contains the search value.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

Returns NULL for NULL array or NULL search element. If no match is found but the array contains a NULL element, returns NULL.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
array_contains(array, element)
```

## Arguments

Type notation used below:

* T is the array element type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT.

| Name | Type | Required | Description |
| - | - | - | - |
| array | ARRAY\<T> | Yes | The array to search. Nested elements/fields must satisfy the same element-type restrictions. |
| element | T | Yes | The element to find. Nested elements/fields must satisfy the same element-type restrictions. |

## Returns

* Type: BOOLEAN
* Possible values: TRUE on a match; FALSE only when a non-NULL search finds no match and the array has no NULL element.
* NULL behavior: Returns NULL for NULL array or NULL search element. If no match is found but the array contains a NULL element, returns NULL.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* The array elements and search value are converted to a common type before comparison.
* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.

## Examples

### Typical behavior

The array contains 2, so the result is TRUE.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT array_contains(ARRAY[1, 2, 3], 2) AS found;
```

| found |
| - |
| true |

If there is no match and the array contains NULL, the result is NULL, as shown next.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT array_contains(ARRAY[1, NULL, 2], 1) AS found, array_contains(ARRAY[1, NULL, 2], 3) AS "unknown";
```

| found | unknown |
| - | - |
| true | NULL |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.