select department.name
from employee inner join department on departmentld=department.id
group by departmentld
order by avg(salary) desc
limit 0,3;
查询不同部门的工资的前三名
create view salary_view as
select salary,employee.name as Employee_name ,departmentld, department.name as Department_name
from employee inner join department on departmentld=department.id
order by departmentld , salary desc;