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 │
└──────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today