Array Element Access ([])

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the element at a specified index position in an array.

Syntax

(<array>)[<index>]

Arguments

Required

  • <array>: The array to access.
  • <index>: The 1-based position of the element to retrieve.

Returns

Returns the value at the specified index position.

Considerations

  • Array indices are 1-based.
  • Accessing an index outside the array bounds returns NULL rather than throwing an error.

Examples

Access First Element

Retrieve the first element from an array.

SELECT (ARRAY[1, 2, 3])[1] AS first_element;

Returns 1, the element at index position 1.

Related Documentation