> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sdf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Comparison Functions

## `greatest`

Returns the largest of the provided values.

*Examples:*

```sql examples.sql theme={null}
SELECT greatest(1, 2, 3) AS value; -- value '3'
```

*Supported Signatures*

```sql theme={null}
function greatest($3, ...) returns $3
```

[🔗 Official Documentation](https://trino.io/docs/current/functions/comparison.html#greatest)

## `least`

Returns the smallest of the provided values.

*Examples:*

```sql examples.sql theme={null}
SELECT LEAST(5,6,7,1,2,3,4) -- list of columns or values -- value '1'
```

*Supported Signatures*

```sql theme={null}
function least($3, ...) returns $3
```

[🔗 Official Documentation](https://trino.io/docs/current/functions/comparison.html#least)
