SQL MIN() and MAX() Functions

The MIN() function returns the minimum value of the selected column.
if we want to get minimum value in a particular column then we use MIN() function.
Syntax
SELECT MIN(column_name) FROM table_name

The MAX() function returns the maximum value of the selected column.
if we want to get maximum value in a particular column then we use MAX() function.
Syntax
SELECT MAX(column_name) FROM table_name

Consider the tbl_student_record table having the following records

id name class subject city phone fee fee_date
1 Mohan 2nd Math Agra 999999990 500 2018-01-02
2 Pooja 3rd English Delhi 999999991 200 2018-01-11
3 Rahul 4th Math Agra 999999992 300 2018-01-05
4 Suresh 2nd English Agra 999999993 400 2018-01-22
5 Vivek 3rd Math Agra 999999994 500 2018-01-01
6 Anuj 2nd English Delhi 999999995 600 2018-01-31
7 Sanju 4th Math Agra 999999996 400 2018-01-17
8 Rohit 3rd English Delhi 999999997 700 2018-01-10
9 Mahesh 3rd Math Agra 999999998 800 2018-01-24
10 Munesh 4th English Delhi 999999999 200 2018-01-09

Now suppose based on the above table WE want to fetch maximum value of student fee, then we can use two type of query−

First Type

SELECT MAX(fee) FROM tbl_student_record

After Query Execution
Output

MAX(fee)
800

Second Type

SELECT MAX(fee) as student_max_fee  FROM tbl_student_record

After Query Execution
Output

student_max_fee
800

Now suppose based on the above table WE want to fetch minimum value of student fee, then we can use two type of query−
First Type

SELECT MIN(fee) FROM tbl_student_record

After Query Execution
Output

MIN(fee)
200

Second Type

SELECT MIN(fee) as student_min_fee  FROM tbl_student_record

After Query Execution
Output

student_min_fee
200