Updated on 2026-11-06 GMT+08:00

min

Function

The min function is used to return the minimum value.

Syntax

min(col)

Parameters

Parameter

Mandatory

Type

Description

col

Yes

Any type except BOOLEAN

Column values can be of any type except BOOLEAN.

Return Values

Returns a value of type DOUBLE.

The return value type is the same as the col type. Return rules are as follows:

  • If col is NULL, that row is excluded from the calculation.
  • If col is of type BOOLEAN, it is not allowed in the computation.

Examples

  • Calculate the minimum inventory (items) across all items. Example command:
    select min(items) from warehouse;

    Result:

    _c0         
    600   
  • Used with GROUP BY to find the minimum inventory for each warehouse. Example command:
    select warehouseId, min(items) from warehouse group by warehouseId;

    Result:

    warehouseId _c1         
    city1      15          
    city2      10          
    city3      19