How do I use the max and min function in SQL?

Max uses when we have to find the maximum value in group/data, and minimum uses when we have to find minimum value from data table/group.

For example you have a table employees:

| employee_id | name | salary |
| 1 | Joe | 10000 |
| 2 | Mike | 20000 |
| 3 | Kim | 30000 |
To select min and max salary:

select min(salary), max(salary) from employees;