Skip to main content

ARRAY_MAX

Returns the largest numeric value in an array. NULL elements are skipped; non-numeric values cause an error.

Syntax

ARRAY_MAX(<array>)

Return Type

Same numeric type as the array elements.

Examples

SELECT ARRAY_MAX([5, 2, 9, -1]) AS max_int;

┌─────────┐
│ max_int │
├─────────┤
9
└─────────┘
SELECT ARRAY_MAX([1.5, -2.25, 3.0]) AS max_decimal;

┌─────────────┐
│ max_decimal │
├─────────────┤
3.00
└─────────────┘
SELECT ARRAY_MAX([NULL, 10, 4]) AS max_with_null;

┌───────────────┐
│ max_with_null │
├───────────────┤
10
└───────────────┘
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today