1 Star 0 Fork 41

zhjmcp/力扣刷题

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
部门公司最高的员工.sql 851 Bytes
一键复制 编辑 原始数据 按行查看 历史
姚振鑫 提交于 2020-05-12 10:37 . sql
Create table Employee
(
Id int primary key identity(1,1) not null,
Name varchar(255) not null,
Salary int not null,
DepartmentId int not null,
)
Create table Department
(
Id int primary key identity(1,1) not null,
Name varchar(255) not null,
)
insert into Employee ( Name, Salary, DepartmentId) values ( 'Joe', 700, 1)
insert into Employee ( Name, Salary, DepartmentId) values ( 'Henry', 800, 2)
insert into Employee ( Name, Salary, DepartmentId) values ( 'Sam',600,2)
insert into Employee ( Name, Salary, DepartmentId) values ( 'Max', 900, 1)
insert into Department ( Name) values ( 'IT')
insert into Department (Name) values ( 'Sales')
select b.Name as Department ,a.Name as Employee ,a.Salary from Department b full join
Employee as a on a.DepartmentId = b.Id where a.Salary=(select max(Salary) from Employee where DepartmentId = b.Id)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
SQL
1
https://gitee.com/zhjmcp/leet_code_sql.git
git@gitee.com:zhjmcp/leet_code_sql.git
zhjmcp
leet_code_sql
力扣刷题
master

搜索帮助