Beginner

386. MAX Function

Learn how to find the maximum value in a dataset.

📘 Lesson 386 of 728 ⏱ 8 min 🎯 Beginner

MAX is an aggregate function that returns the largest non-NULL value from a set of values.

Maximum values help identify the highest salary, largest transaction, latest date, or highest sales value.

Find the highest employee salary.

SQL
SELECT
    MAX(Salary) AS MaximumSalary
FROM Employees;

MAX is commonly used in financial analysis, sales reporting, performance analysis, and date-based reporting.

  • MAX returns the largest value.
  • NULL values are generally ignored.
  • It works with numeric values.
  • It can work with dates and comparable values.
  • It can be combined with GROUP BY.
What does MAX do?

MAX returns the largest non-NULL value from the selected expression.

Can MAX find the latest date?

Yes. MAX on a date column returns the latest date.

Have you finished this lesson?

Introduction to SQL – All Lessons