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 |
Recommended Posts:
- Max(), Min() and Mod() Function in MariaDB
- SQL MIN() and MAX()
- Hex() and Oct() Function Function in MS Access
- SLN() and SYD() Function Function in MS Access
- DDB () and FV() Function Function in MS Access
- Val() and Sum() Function in MS Access
- Sgn() and Sqr() function in MS Access
- StrConv() and StrReverse() Function in MS Access
- Chr() and Asc() Function in MS Access
- InStr() and InstrRev() Function in MS Access
- LCase() and UCase () Function in MS Access
- Str() and StrComp() Function in MS Access
- Replace() and Space() Function in MS Access
- Exp() and Count() Function in MS Access
- Mid() and Len() Function in MS Access
- LTrim() and RTrim() Function in MS Access
- Left() and Right() Function in MS Access
- Rnd() and Round Function in MS Access
- Fix() and Format() Function in MS Access
- Second() and Time() Function in MS Access
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

