CDA117556

2022-01-18   阅读量: 299

Mysql

子查询

扫码加入数据分析学习群

8、标量子查询:select * from emp

where sal>(select avg(sal) from emp);

9、行子查询:select empno, ename,job,deptno

from emp

where (deptno,job)=(select deptno,

job from emp where ename='smith' )
and ename<>'smith';

10、子查询操作符:

not in() 在/不在其中

any 满足其中任意一个

all 都满足

11、列子查询:select * from

emp left join saligrade

on sal between lasal and hisal

where yuangongid not in (select

lingdao id from where is not null) ;

12、any操作符(任意一个): select * from emp where sal >any(select sal from emp where deptno=30) and deptno<>30;

13、all操作符: select * from emp where sal >

all(select sal from emp where deptno=30);


37.6361 8 0 关注作者 收藏

评论(0)


暂无数据

推荐课程