Skip to main content
Returns the minimum value within the requested window. For more information on usage, please refer to Window Functions.

Syntax

MIN( <expression> ) OVER ( [ PARTITION BY <partition_by> ] )

Parameters

ParameterDescriptionSupported input types
<expression>A value used for the MIN functionAny
<partition_by>An expression used for the PARTITION BY clause.Any

Example

The example below shows each player’s score alongside the lowest score in their level. Unlike a regular MIN() aggregation, the window function keeps one row per player while also showing the partition minimum.
SELECT
    nickname,
    level,
    current_score,
    MIN(current_score) OVER (PARTITION BY level) AS lowest_score
FROM
    (VALUES
        ('kennethpark', 9, 76),
        ('sabrina21', 9, 90),
        ('burchdenise', 10, 79),
        ('ymatthews', 10, 85),
        ('rileyjon', 10, 80)
    ) AS t(nickname, level, current_score)
ORDER BY level, nickname;
nickname textlevel intcurrent_score intlowest_score int null
kennethpark97676
sabrina2199076
burchdenise107979
rileyjon108079
ymatthews108579

Rows: 5Execution time: 1.81ms