Aggregates
Aggregate
min()
Returns the minimum value present in arg.
Arguments & returns
2 overloadsmin(arg)
Aggregate
| Overload link | arg |
Returns |
|---|---|---|
| #01 | ANY |
ANY |
min(arg, col1)
Aggregate
| Overload link | arg | col1 |
Returns |
|---|---|---|---|
| #02 | ANY | BIGINT |
ANY[] |
Example
Haybarn WASM 1.5.5-rc3 · In your browser
Engine example with sample data · Run to view results.
In other engines
Used in larger rewrites 2
These examples use min as one part of a larger SQL translation.
PostgreSQL
SELECT DATE_BIN('30 days', timestamp_col, (SELECT MIN(TIMESTAMP) from table)) FROM table
SELECT TIME_BUCKET('30 days', timestamp_col, (SELECT MIN(TIMESTAMP) FROM "table")) FROM "table"
Snowflakeminhash_combine()
MINHASH_COMBINE(sig_col)
(SELECT JSON_OBJECT('state', LIST(min_h ORDER BY idx NULLS FIRST), 'type', 'minhash', 'version', 1) FROM (SELECT pos AS idx, MIN(val) AS min_h FROM UNNEST(LIST(sig_col)) AS _(sig) JOIN UNNEST(CAST(sig -> '$.state' AS UBIGINT[])) WITH ORDINALITY AS t(val, pos) ON TRUE GROUP BY pos))