ARRAY_LENGTH

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the total number of elements in an array.

Syntax

array_length(<array>)

Arguments

Required

  • <array>: The array to measure.

Returns

Returns an integer that represents the total number of elements in the array.

Considerations

  • Returns the count of all elements including NULL and duplicate values.
  • For an empty array, returns 0.

Examples

Count Array Elements

Determine the number of elements in an array.

SELECT array_length(array[1, 2, 3]) AS element_count;

Returns 3, counting all elements in the array.

Related Documentation