表子查询:返回的结果是多行多列
常用的操作符:in
代码:
-- 查询和员工333和员工444的职位,薪资都相同的员工
select * from emp where (salary,job) in (select salary,job from emp where name='333' or name='444');
-- 查询入职时间在‘2006-01-01‘之后的员工信息以及部门信息
select e.* ,d.* from (select * from emp where entrydate>'2006-01-01') as e left join dept as d on e.dept_id=d.id;