Group By Using MIN function
suggest changeAssume a table of employees in which each row is an employee who has a name, a department, and a salary.
SELECT department, MIN(salary) AS "Lowest salary"
FROM employees
GROUP BY department;
This returns each department and the lowest salary in that department, not which one department is the lowest overall. Finding the name of the employee who earns that salary is a different problem. See “groupwise max”.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents