MIN() OVER ...

All functions > WINDOW FUNCTION > MIN() OVER ...

Returns the minimum value in the window frame.

Syntax

MIN(expr) [FILTER (WHERE condition) | WITHIN (WHERE condition)] OVER ([PARTITION BY expr [, ...]] [ORDER BY sort_item [, ...]] [ROWS|RANGE|GROUPS frame])

Notes

  • Default frame is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
  • NULL values are ignored in the calculation

See also

Examples

FeatureQL
SELECT
    -- Running minimum (v permuted so the series is not constant)
    f1 := ZIP(ARRAY(1, 2, 3, 4) AS id, ARRAY(30, 10, 20, 5) AS v).TRANSFORM(
        SELECT MIN(v) OVER (ORDER BY id ASC)
    ).UNWRAP(),
    -- Running minimum counting only rows where v > 15 (10 and 5 excluded from the frame)
    f2 := ZIP(ARRAY(1, 2, 3, 4) AS id, ARRAY(30, 10, 20, 5) AS v).TRANSFORM(
        SELECT MIN(v) FILTER (WHERE v > 15) OVER (ORDER BY id ASC)
    ).UNWRAP()
;
Result
f1 ARRAYf2 ARRAY
[30, 10, 10, 5][30, 30, 20, 20]

Last update at: 2026/06/20 10:08:10