I have the following query:
select round(avg(employees.salary)) as "Average salary",
count(1) as "Number of employees",
employees.department_id as "Department ID",
departments.department_name as "Department Name"
from employees, departments
where employees.department_id = departments.department_id
group by employees.department_id, departments.department_name
order by round(avg(employees.salary)) desc;
The returned result is not in the desired order. However, when trying to use alias "Average salary" or 1 the query works just as expected and desired.
The result of the mentioned query:
The result when I use an alias or number:
Why?

