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

# array_flatten

> array_flatten flattens one layer of nested arrays.

`array_flatten` flattens one layer of nested arrays.

## Syntax

```Haskell theme={null}
array_flatten(param)
```

## Parameters

`param`: a nested array that needs to be flattened. Only nested arrays are supported, and it can be a multi-level nested array, the elements of the array can be any data type supported by the database.

## Return value

The data type of the return value is an array type after flattening one layer.

## Examples

Example 1: Flatten a 2-level nested array.

```plaintext theme={null}
mysql> SELECT array_flatten([[1, 2], [1, 4]]) as res;
+-----------+
| res       |
+-----------+
| [1,2,1,4] |
+-----------+
```

Example 2: Flatten a 3-level nested array.

```plaintext theme={null}
mysql> SELECT array_flatten([[[1],[2]], [[3],[4]]]) as res;
+-------------------+
| res               |
+-------------------+
| [[1],[2],[3],[4]] |
+-------------------+
```


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