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

# `array_distinct` 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 duplicate values from `array`.

## Syntax

```
array_distinct(array)
```

## Arguments

* `array`: An ARRAY expression.

## Returns

The function returns an array of the same type as the input argument where all duplicate values have been removed.

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_distinct(array(1, 2, 3, NULL, 3));
 [1,2,3,NULL]
```

## Related functions

* [`array_except` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_except.md)
* [`array_intersect` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_intersect.md)
* [`array_sort` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_sort.md)
* [`array_remove` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_remove.md)
* [`array_union` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_union.md)
