SQL MIN() & MAX() Function


The MIN() Function

The MIN() function returns the smallest value of the selected column.

Syntax

SELECT MIN(column_name) FROM table_name;

Example

student Table

stud_sidstud_namestud_fee
11211Ashwani200
11212Sachin400
11213Deepak600
11214Sanjay800
SELECT MIN(stud_fee) FROM student;
Output
200

The MAX() Function

The MAX() function returns the largest value of the selected column.

Syntax

SELECT MAX(column_name) FROM table_name;

Example

student Table

stud_sidstud_namestud_fee
11211Ashwani200
11212Sachin400
11213Deepak600
11214Sanjay800
SELECT MAX(stud_fee) FROM student;
Output
800

Share this article on