Skip to main content
/1 min read

SQL MAX Tutorial

How MAX Works

Returns Highest Value

MAX retrieves the maximum value of a given column.

Syntax

SELECT MAX(column_1) FROM table;

Common Use

Finding the player with the most rebounds — SELECT MAX(rebounds) FROM players;

Pair with WHERE

MAX with WHERE filters first then finds the max — top scorer on team B, etc.

Master SQL at Noble Desktop

Noble Desktop's SQL Bootcamp covers queries, joins, aggregations, and the full SQL toolkit data analysts use every day.

Learn the basics of the MAX function in SQL with an example and screenshots.

MAX Function

  • The MAX function is used to find the maximum value of a given column.

  • It retrieves the maximum value of a given column from our data.

  • Syntax: SELECT MAX(column_1) FROM table ;

Example

Let’s say we have a basketball league and we keep records of each player, which team they are on, and their basic statistics.

Stats Table

If we wanted to use a SQL query to find the player with the most rebounds, we would write the following:

SQL MAX statement

Once we hit ENTER and run, our result should be as follows:

SQL MAX Result