> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

> Reference material for ARRAY_REVERSE function

# ARRAY_REVERSE

Returns an array of the same size and type as the original array, with the elements in reverse order. Nulls are retained.

## Syntax

```sql theme={"theme":{"light":"css-variables","dark":"css-variables"}}
ARRAY_REVERSE(<array>)
```

## Parameters

| Parameter | Description              | Supported input types |
| :-------- | :----------------------- | :-------------------- |
| `<array>` | The array to be reversed | `ARRAY` of any type   |

## Return Type

`ARRAY` of the same type as the input array

## Examples

The following example returns the reverse of the input array:

<div className="query-window">
  ```
  SELECT ARRAY_REVERSE([1, 2, 3, 6]);
  ```

  | array\_reverse <span>array(int)</span> |
  | :------------------------------------- |
  | \[6, 3, 2, 1]                          |

  <p><span>Rows: 1</span><span>Execution time: 6.41ms</span></p>
</div>

Only the outermost array is reversed for nested arrays:

<div className="query-window">
  ```
  SELECT ARRAY_REVERSE([[1,2,3], [4,5], NULL, [7], [8,9]]);
  ```

  | array\_reverse <span>array(array(int) null)</span> |
  | :------------------------------------------------- |
  | \[\[8, 9], \[7], NULL, \[4, 5], \[1, 2, 3]]        |

  <p><span>Rows: 1</span><span>Execution time: 5.93ms</span></p>
</div>
