Return
name (department name)avg_salary (average salary of employees in the department)avg_salary descending.Expected output
| name | avg_salary |
|---|---|
| 2 rows — values hidden, that's the puzzle | |
Your query should return 2 rows with these columns. Your column aliases don't need to match.
departments
| id | name |
|---|---|
| 1 | Engineering |
| 2 | Sales |
| 3 | Marketing |
| 4 | Operations |
employees
| id | name | department_id | manager_id | salary | hired_on |
|---|---|---|---|---|---|
| 1 | Ana Reyes | 1 | NULL | 150000 | 2018-03-01 |
| 2 | Ben Cho | 1 | 1 | 120000 | 2019-06-15 |
| 3 | Cara Diaz | 1 | 1 | 120000 | 2020-01-20 |
| 4 | Dan Ellis | 2 | NULL | 140000 | 2017-11-05 |
| 5 | Eve Fox | 2 | 4 | 95000 | 2021-02-10 |
0 of 3 hints revealed
Submit an attempt first.