题解 | #获取每个部门中当前员工薪水最高的相关信息# 简单明了

获取员工其当前的薪水比其manager当前薪水还高的相关信息

http://www.nowcoder.com/practice/f858d74a030e48da8e0f69e21be63bef

# 两个表:
# 1.员工薪水部门表
# 2.经理薪水部门表
# 3.两个表根据部门链接
# 4.筛选出员工薪水>经理薪水的记录
select t1.emp_no,t2.manager_no,t1.salary,t2.salary
from (select d.emp_no,salary,dept_no
      from dept_emp d,salaries s
      where d.emp_no=s.emp_no) as t1, -- 员工薪水部门表
      (select dp.emp_no manager_no,salary,dept_no
       from dept_manager dp,salaries s
       where dp.emp_no=s.emp_no) as t2 -- 经理薪水部门表
where t1.dept_no=t2.dept_no
and t1.salary>t2.salary
全部评论

相关推荐

10-10 01:10
已编辑
深圳大学 测试开发
面了100年面试不知...:六月到九月,四个项目一个实习,是魔丸吗
投了多少份简历才上岸
点赞 评论 收藏
分享
Aurora23:属于挂一半,暂时进池子了,隔一段时间没有其他组捞的话就彻底结束了
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务