📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

SLICE



Extracts a slice from the array by index (1-based).

Syntax

SLICE( <array>, <start>[, <end>] )

Aliases

Examples

SELECT ARRAY_SLICE([1, 21, 32, 4], 2, 3), SLICE([1, 21, 32, 4], 2, 3); ┌─────────────────────────────────────────────────────────────────┐ │ array_slice([1, 21, 32, 4], 2, 3) │ slice([1, 21, 32, 4], 2, 3) │ ├───────────────────────────────────┼─────────────────────────────┤ │ [21,32] │ [21,32] │ └─────────────────────────────────────────────────────────────────┘

Was this page helpful?