## Day 11 – SQL MIN() and MAX() Functions

In SQL, the ** MIN()** and

**functions are used to find the minimum and maximum values of a column in a table, respectively. These functions are often used in combination with the**

`MAX()`

**statement to retrieve summary information about data.**

`SELECT`

The basic syntax for using the ** MIN()** and

**functions is as follows:**

`MAX()`

```
SELECT MIN(column_name) FROM table_name;
SELECT MAX(column_name) FROM table_name;
```

Here, ** column_name** is the name of the column for which you want to find the minimum or maximum value, and

**is the name of the table that contains the column.**

`table_name`

For example, suppose you have a table called ** sales** with columns

**and**

`product_name`

**. If you want to find the minimum and maximum sales amounts for all products, you would use the following SQL statements:**

`sales_amount`

```
SELECT MIN(sales_amount) FROM sales;
SELECT MAX(sales_amount) FROM sales;
```

These statements will return the minimum and maximum sales amounts for all products in the ** sales** table.

Note that if the column specified in the ** MIN()** or

**function contains null values, those values will be ignored in the calculation.**

`MAX()`