> For the complete documentation index, see [llms.txt](https://gyansetu-sql.gitbook.io/sql-programming/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gyansetu-sql.gitbook.io/sql-programming/sql-select/sql-server-functions/sql-min-and-max.md).

# SQL MIN() and MAX()

### The SQL MIN() and MAX() Functions

The MIN() function returns the smallest value of the selected column.

The MAX() function returns the largest value of the selected column.

#### MIN() Syntax

```sql
SELECT MIN(column_name)
FROM table_name
WHERE condition;
```

#### MAX() Syntax

```sql
SELECT MAX(column_name)
FROM table_name
WHERE condition;
```

### Demo Database

> &#x20;Below is a selection from the "Products" table in the Northwind sample database:

![](https://826093633-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LS8lPNzCGPR5-DLbGXv%2F-LSOse7cGzsWIK2Mwobv%2F-LSOz-CFbiATADZz_7Hp%2Fimage.png?alt=media\&token=99252a7a-8639-4c78-beac-db4ed0fee60c)

### MIN() Example

> &#x20;The following SQL statement finds the price of the cheapest product
>
> #### Example

```sql
SELECT MAX(Price) AS LargestPrice
FROM Products;
```
