Max() and Min() function in MS Access
1. Max() Function :
max() function return the maximum value of given set. In the function a query is passed and in the eligible records which value will be maximum that will return as result. A expression will be pass as parameter and it will return the maximum value in the expression.
Syntax :
Max (expression)
Demo Database for example :
Table name : student
student_id | Marks |
---|---|
121 | 56 |
122 | 45 |
123 | 89 |
124 | 50 |
Example-1 :
SELECT Max(Marks) AS marks FROM student;
Output –
marks |
---|
89 |
Example-2 :
SELECT Max(Marks) AS marks FROM student where Marks<80;
Output –
marks |
---|
56 |
2. Min() Function :
min() function works like max() function but it will return the minimum value of the expression. In this function a query will be passed as parameter and it will return the minimum record.
Syntax :
Min(expression)
Example-1 :
SELECT Min(Marks) AS marks FROM student;
Output –
marks |
---|
45 |
Example-2 :
SELECT Min(Marks) AS marks FROM student where Marks>50;
Output –
marks |
---|
56 |
Please Login to comment...