MySql 任务
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySql 任务相关的知识,希望对你有一定的参考价值。
项目7
统计各部门工资最高的员工
create table employee( id int not null, name varchar(32) not null, salary int not null, departmentid int not null ); insert into employee (id,name,salary,departmentid) values (1,‘Joe‘,70000,1), (2,‘Henry‘,80000,2), (3,‘Sam‘,60000,2), (4,‘Max‘,90000,1); create table department( id int not null, name varchar(32) not null ); insert into department(id,name) values (1,‘IT‘), (2,‘Sales‘); select d.name as department, e.name, e.salary from empolyee e join (select max(salary) as salary from employee group b departmentid) as g on e.salary=g.salary left join department d on e.departmentid=d.id;
以上是关于MySql 任务的主要内容,如果未能解决你的问题,请参考以下文章