โ† SQL & Databases
#7 most askedVery commonEasyGroup by

Average Salary by Department

New to Group by? Learn it from scratch first
Grouping Results with GROUP BY โ†’
๐Ÿข Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.
I was asked this

Return department and avg_salary (rounded to the nearest whole number) for every department that has employees, highest average first.

๐Ÿงช Practice

Write the query, then press Run tests to compare your rows with the expected result.

SQL
SELECT *
FROM employees;

Output appears here. Press Run or Ctrl/โŒ˜ + Enter.

Try it first. Struggling for a few minutes is how it sticks.