SQLite MAX

The SQLite MAX function calculates and returns the maximum value of all values in a set.

Syntax

Here is the syntax of SQLite MAX function:

SELECT MAX(column_name) FROM table_name;

The type of column_name must be NUMERIC or INTEGER.

Example

Table of books

ID NAME PRICE
1 SQLite 10
2 SQL 20
3 PL/SQL 30
4 PHP NULL
5 Python 20
6 HTML 40

MAX function example

SELECT MAX(PRICE) FROM books;

MAX result: 40

The example above shows how to get the maximum price of a book. For this, the SELECT statement uses the PRICE column inside the brackets of the MAX function.