SQL Function: MAX()
Definition:
Return the highest value of records.
Command Syntax:
MAX(field_name)
Command Example:
Table STUDENT| SID | SNAME | CLASS | CNO | MARK |
|---|---|---|---|---|
| 010122 | Chris Wong | 1A | 5 | 19.4 |
| 010141 | Gabe Lin | 1C | 6 | 35.6 |
| 010142 | Nico Lin | 1C | 7 | 34.8 |
| 010133 | Amy Chan | 2D | 12 | -97.5 |
Input:
SELECT CLASS,MAX(*) AS Result FROM STUDENT GROUP BY CLASS;
Output:
| CLASS | Result |
|---|---|
| 1A | 19.4 |
| 1C | 35.6 |
| 2D | -97.5 |
‘...’By secondary 6 student
Comments
Post a Comment