SEQUENCE

All functions > ARRAY > SEQUENCE

Generates an array containing a sequence of numbers from start to stop with optional step.

Syntax

SEQUENCE(start, stop, step)
sql

Arguments

ParameterTypeRequiredDescription
startBIGINTYesStarting value (inclusive)
stopBIGINTYesEnding value (inclusive)
stepBIGINTYesOptional step value (default: 1)

Returns

ARRAY(BIGINT) - Array of numbers in the sequence

Notes

  • Generates sequence from start to stop inclusive
  • Default step is 1
  • Can use negative step for descending sequences
  • Both start and stop are included in result
Last update at: 2025/10/13 10:23:46