To return or fetch the largest value from the selected column, the MAX() function is used.

 

SQL MAX() Syntax is as follows:

Select MAX(column_name)

From table_name;

 

Let us consider the below Students table:

roll_no

Name

total_marks

(out of 600)

percentage

grade

1

Ashok

392

65.33

B

2

Chaitali

454

75.67

A

3

Smriti

502

83.60

A

4

Kaushik

337

56.10

C

 

Now suppose based on the above table you want to fetch maximum value of total marks, then you can do so simply using the following command:

Select Max(total_marks)

Form Students;

 

The result will be as follows:

MAX(total_marks)

502

1 row in set (0.00 sec)