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

# `array` 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 11.3 LTS and above

Returns an array with the elements in `expr`.

## Syntax

```
array(expr [, ...])
```

## Arguments

* `exprN`: Elements of any type that share a least common type.

## Returns

An array of elements of `exprNs` least common type.

If the array is empty or all elements are NULL the result type is an array of type null.

## Examples

```sql
-- an array of integers
> SELECT array(1, 2, 3);
 [1,2,3]
-- an array of strings
> SELECT array(1.0, 1, 'hello');
 [1.0,1,hello]
```

## Related

* [\[ \] operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/bracketsign.md)
* [`map` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/map.md)
* [`collect_set` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/collect_set.md)
* [`collect_list` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/collect_list.md)
* [SQL data type rules](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-datatype-rules.md)
