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
Parameter | Type | Required | Description |
---|---|---|---|
start | BIGINT | Yes | Starting value (inclusive) |
stop | BIGINT | Yes | Ending value (inclusive) |
step | BIGINT | Yes | Optional 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