A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/functions/least below:

Website Navigation


LEAST | Snowflake Documentation

Categories:

Conditional expression functions

LEAST

Returns the smallest value from a list of expressions. LEAST supports all data types, including VARIANT.

See also:

LEAST_IGNORE_NULLS

Syntax
LEAST(( <expr1> [ , <expr2> ... ] )

Copy

Arguments
exprN

The arguments must include at least one expression. All the expressions should be of the same type or compatible types.

Returns

The first argument determines the return type:

If any argument is NULL, returns NULL.

Collation details Examples

The following examples use the LEAST function:

SELECT LEAST(1, 3, 0, 4);

Copy

+-------------------+
| LEAST(1, 3, 0, 4) |
|-------------------|
|                 0 |
+-------------------+
SELECT col_1,
       col_2,
       col_3,
       LEAST(col_1, col_2, col_3) AS least
  FROM (SELECT 1 AS col_1, 2 AS col_2, 3 AS col_3
    UNION ALL
    SELECT 2, 4, -1
    UNION ALL
    SELECT 3, 6, NULL);

Copy

+-------+-------+-------+-------+
| COL_1 | COL_2 | COL_3 | LEAST |
|-------+-------+-------+-------|
|     1 |     2 |     3 |     1 |
|     2 |     4 |    -1 |    -1 |
|     3 |     6 |  NULL |  NULL |
+-------+-------+-------+-------+

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4