The MAX()
function returns the biggest value of an expression when using SELECT.
Structure
SELECT MAX(EXPRESSION)
FROM TABLE
WHERE [CONSTRAINTS]
Example
Building on our previous examples, let’s find out which position in Company A has the highest salary:
SELECT p.position_name, MAX(s.salary) max_salary from
salaries s
JOIN positions p on p.ID = s.positions_id;