MAX – Return largest value of selected column – Aggregate Functions

You can use MAX function to return the largest value of your selected column.
The value can be number, character, datetime.

example: Return the highest salary of employees.

SELECT MAX(salary) FROM tbEmpTable

MAX(salary)
--------------------------------
543000

example: Return the highest salary in each department.

SELECT deptCD, MAX(salary) FROM tbEmpTable
GROUP BY deptCD;

deptCD,       MAX(salary)
--------------------------------
100               200000
200               302000
300               380000
400               630000

Posted in Aggregate Functions