Returns a slice of the array based on the indicated offset and length.

Syntax

ARRAY_SLICE(<array>, <start>[, <length>])

Parameters

ParameterDescriptionSupported input types
<array>The array of data to be slicedARRAY
<start>Indicates starting point of the array sliceINTEGER
<length>The length of the required sliceINTEGER

Return Type

ARRAY of the same type as input array

Example

The following example slices the levels array to a different length:

SELECT
	ARRAY_SLICE([ 1, 2, 3, 4, 5 ], 1, 3) AS levels;

Returns: [1, 2, 3]