-- 列子查询:子查询返回的结果只有一列(常用操作符:IN,NOT IN, ANY, SOME,ALL)
-- IN 在指定的集合范围内多选1
-- NOT IN 不在指定的集合范围之内
-- ANY 子查询返回列表中,有一个条件满足即可
-- SOME 与ANY一样,能用SOME的地方均可用ANY
-- ALL 子查询列表中所有值都必须满足
-- 1.查询销售部和市场部的部门id
select id from dept where name = '销售部' or name = '市场部';
-- 2.根据部门信息,查询员工信息
select *from emp where deot_id in (select id from dept where name = '销售部' or name = '市场部');
-- 3.查询比财务部所有人工资都高的员工信息
select *from emp where salary > all (select salary from emp where deot_id in (select id from dept where name = '财务部'));
-- 4.查询比研发部中其中一人工资高的员工信息
-- a.查询研发部所有人工资
select salary from emp where deot_id = (select id from dept where name = '市场部');
-- b.查询比研发部中其中一人工资高的员工信息
select *from emp where salary >any (select salary from emp where deot_id = (select id from dept where name = '市场部'));