AdvancedGROUP BY & Aggregation
Mode: most common salary value
The query
SQL
SELECT
dept_id,
MODE() WITHIN GROUP (ORDER BY salary) AS most_common_salary
FROM employees
GROUP BY dept_id;Note
“MODE() returns the most frequent value. It's an ordered-set aggregate function.