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

> Reference material for MIN

# MIN

Returns the minimum value in its argument. `NULL` values are ignored. If all inputs are `NULL`, `MIN` returns NULL.

## Syntax

```sql theme={"theme":{"light":"css-variables","dark":"css-variables"}}
MIN(<expression>) [FILTER ([WHERE] <condition>)]
```

## Parameters

| Parameter      | Description                                                       | Supported input types |
| :------------- | :---------------------------------------------------------------- | :-------------------- |
| `<expression>` | The expression whose minimum to determine                         | Any type              |
| `<condition>`  | An optional boolean expression to filter rows used in aggregation | `BOOL`                |

## Return Types

Same as input type

## Examples

The `tournaments` table contains the following data:

<div className="query-window">
  ```
  SELECT name, totalprizedollars FROM tournaments ORDER BY totalprizedollars LIMIT 5;
  ```

  | name <span>text null</span>          | totalprizedollars <span>int null</span> |
  | :----------------------------------- | :-------------------------------------- |
  | The French Grand Prix                | 237                                     |
  | The European Grand Prix              | 465                                     |
  | The Desert Dash Rally                | 643                                     |
  | The Turbocharged Championship Series | 704                                     |
  | The African Grand Prix               | 895                                     |

  <p><span>Rows: 5</span><span>Execution time: 6.00ms</span></p>
</div>

The following example finds the smallest prize amount in the `tournaments` table:

<div className="query-window">
  ```
  SELECT MIN(totalprizedollars) AS minprize FROM tournaments;
  ```

  | minprize <span>int null</span> |
  | :----------------------------- |
  | 237                            |

  <p><span>Rows: 1</span><span>Execution time: 5.74ms</span></p>
</div>

`MIN` also works on text columns, returning the lexicographically smallest value. The following example finds the tournament name that comes first alphabetically:

<div className="query-window">
  ```
  SELECT MIN(name) AS mintournament FROM tournaments;
  ```

  | mintournament <span>text null</span> |
  | :----------------------------------- |
  | The Acceleration Championship        |

  <p><span>Rows: 1</span><span>Execution time: 6.22ms</span></p>
</div>
