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

# `get` 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 the element of an `arrayExpr` at `index`, starting with `0`.

## Syntax

```
get(arrayExpr, index)
```

## Arguments

* `arrayExpr`: An ARRAY expression.
* `index`: An INTEGER expression specifying the index in the array.

## Returns

The result is of the type of the elements of `arrayExpr`.

If the `index` is negative or outside the bounds of the array the result is `NULL`.
To return an [INVALID\_ARRAY\_INDEX](https://docs.databricks.com/aws/en/error-messages/invalid-array-index-error-class.md) error instead, use the [arrayExpr\[index\]](https://docs.databricks.com/aws/en/sql/language-manual/functions/bracketsign.md) operator.

## Examples

```sql
> SELECT element_at(arr, 2), get(arr, 0), get(arr, 2), arr[2] FROM VALUES(array(1, 2, 3)) AS T(arr);
 2  1  3  3
> SELECT get(arr, 5), get(arr, -1) FROM VALUES(array(1, 2, 3)) AS T(arr);
 NULL NULL
```

## Related functions

* [`array_contains` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_contains.md)
* [`array_position` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_position.md)
* [`element_at` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/element_at.md)
* [`[]` bracket sign](https://docs.databricks.com/aws/en/sql/language-manual/functions/bracketsign.md)
