MySql(四) 任务
时间:2021-07-01 10:21:17
帮助过:15人阅读
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(四) 任务
标签:rtm ble color font varchar sel null style sql