Skip to main content

SUBLIST

Categories: Semi-Structured Data

SUBLIST

Returns an array constructed from the specified subset of elements of the input array.

Syntax

SUBLIST(arr LIST, offset INT, length INT) → LIST

  • arr: The input array.
  • offset: The offset from which the sublist should start.
  • length: The maximum length of the sublist.

Examples

SUBLIST example
SELECT SUBLIST(ARRAY[1,2,3,4,5], 0, 3)
-- [1,2,3]
SUBLIST example
SELECT SUBLIST(ARRAY[1,2,3,4,5], 3, 3)
-- [3,4,5]