Skip to main content

ARRAY_MIN

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

Syntax

ARRAY_MIN(<array>)

Return Type

Same numeric type as the array elements.

Examples

SELECT ARRAY_MIN([5, 2, 9, -1]) AS min_int;

┌─────────┐
│ min_int │
├─────────┤
-1
└─────────┘
SELECT ARRAY_MIN([1.5, -2.25, 3.0]) AS min_decimal;

┌──────────────┐
│ min_decimal │
├──────────────┤
-2.25
└──────────────┘
SELECT ARRAY_MIN([NULL, 10, 4]) AS min_with_null;

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