Intermediate · Lesson 3 of 20

MIN and MAX

MIN finds the smallest value. MAX finds the largest value.

Highest salary:

SELECT MAX(salary) FROM employees;

Lowest salary:

SELECT MIN(salary) FROM employees;

Both in one query:

SELECT MIN(salary) as lowest,
       MAX(salary) as highest
FROM employees;

Works with dates and text too!

Check your understanding

Find both the minimum and maximum salary.

Examples run on the employees sample database. Open any of them in the playground to experiment.