题解 | #使用含有关键字exists查找未分配具体部门的员工的所有信息。#

使用含有关键字exists查找未分配具体部门的员工的所有信息。

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

exists / not exists : 存在/不存在,即将外表(employees表)的字段(emp_no)代入子查询(内表)中看是否成立/不成立。

select a.emp_no,a.birth_date,a.first_name,a.last_name,a.gender,a.hire_date
from employees a 
where not exists 
(select emp_no from dept_emp b where b.emp_no = a.emp_no);

直接外联结

select a.emp_no,a.birth_date,a.first_name,a.last_name,a.gender,a.hire_date
from employees a left join dept_emp b 
on a.emp_no = b.emp_no 
where b.dept_no is null;
全部评论

相关推荐

小浪_Coding:找硬件测试,也可兼顾软测欧, 简历还可以的 ,注意排版,项目写的有条理一点, 然后个人技能多加点, 润色好简历之后就开始沟通海投了,深圳,东莞这边做硬件相关的公司还不少, 医疗类,仪器类的都可以尝试
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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