SelectDB Cloud
SQL 手册
SQL 函数
分析(窗口)函数
WINDOW_FUNCTION_MIN

WINDOW FUNCTION MIN

description

LEAD() 方法用来计算窗口内的最小值。

MAX([DISTINCT | ALL] expression) [OVER (analytic_clause)]

example

计算从第一行到当前行之后一行的最小值

select x, property,   
min(x) over    
(    
order by property, x desc    
rows between unbounded preceding and 1 following   
) as 'local minimum'   
from int_t where property in ('prime','square');
| x | property | local minimum |
|---|----------|---------------|
| 7 | prime    | 5             |
| 5 | prime    | 3             |
| 3 | prime    | 2             |
| 2 | prime    | 2             |
| 9 | square   | 2             |
| 4 | square   | 1             |
| 1 | square   | 1             |

keywords

WINDOW,FUNCTION,MIN
© 2023 北京飞轮数据科技有限公司 京ICP备2022004029号 | Apache、Apache Doris 以及相关开源项目名称均为 Apache 基金会商标