---
title: array_remove function
description: Learn the syntax of the array\_remove function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/array_remove
---

# `array_remove` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Removes all occurrences of `element` from `array`.

## Syntax

```
array_remove(array, element)
```

## Arguments

* `array`: An ARRAY.
* `element`: An expression of a type sharing a [least common type](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-datatype-rules.md#least-common-type-resolution) with the elements of `array`.

## Returns

The result type matched the type of the array.

If the element to be removed is `NULL`, the result is `NULL`.

Databricks raises [COLLECTION\_SIZE\_LIMIT\_EXCEEDED](https://docs.databricks.com/aws/en/error-messages/collection-size-limit-exceeded-error-class.md) if the result exceeds the array size limit.

## Common error conditions

* [COLLECTION\_SIZE\_LIMIT\_EXCEEDED](https://docs.databricks.com/aws/en/error-messages/collection-size-limit-exceeded-error-class.md)

## Examples

```sql
> SELECT array_remove(array(1, 2, 3, NULL, 3, 2), 3);
 [1,2,NULL,2]
> SELECT array_remove(array(1, 2, 3, NULL, 3, 2), NULL);
 NULL
```

## Related

* [`array_except` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_except.md)
* [SQL data type rules](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-datatype-rules.md)
