Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to: Databricks SQL
Databricks Runtime
Returns the maximum value of expr
in a group.
Syntax
max(expr) [FILTER ( WHERE cond ) ]
This function can also be invoked as a window function using the OVER
clause.
Arguments
expr
: An expression of any type that can be ordered.cond
: An optional boolean expression filtering the rows used for aggregation.
Returns
The result type matches the type of the argument.
Note
For certain STRING
collations, such as UTF8_LCASE
, the result may be non-deterministic.
Examples
> SELECT max(col) FROM VALUES (10), (50), (20) AS tab(col);
50
-- The result is non-deterministic due to collation
> SELECT max(col COLLATE UTF8_LCASE) FROM VALUES ('a', 'A') AS tab(col);
a (or A)