> ## 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.

# GET

> Returns the element at a zero-based array index.

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

Returns NULL for NULL inputs, a NULL selected element, negative index, or an index beyond the end.

## Syntax

### Scalar

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

## 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 access. Nested elements/fields must satisfy the same element-type restrictions. |
| index | INTEGER | Yes | The zero-based position. |

## Returns

* Type: T
* Possible values: The selected element.
* NULL behavior: Returns NULL for NULL inputs, a NULL selected element, negative index, or an index beyond the end.

## Properties

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

## Usage notes

* 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

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT get(ARRAY[10, 20], 1) AS "value", get(ARRAY[10, 20], -1) AS negative;
```

| value | negative |
| - | - |
| 20 | NULL |

### Access a string array

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT get(ARRAY('red', 'blue'), 0) AS first_color, get(ARRAY('red', 'blue'), 2) AS out_of_bounds;
```

| first\_color | out\_of\_bounds |
| - | - |
| red | NULL |


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