黑马作文650字怎么写?( 三 )


--相当于
select * from emp where deptno=10 or deptno=20
--而下面的语句
select * from emp where deptno in (10,20) minus select * from emp where sal select * from emp where deptno in(10,20) and sal>=1500
--求分段显示薪水的个数
如:
scale total 5000 8
select \\'union select \\'=801
--或者显示成为
--注意:使用between ..and ..的时候,包含了最大和最小值 。800-1000 1001-2000 2001-5000 2 3 6 select * from (select count(*) as "800-1000" from emp where sal >=800 and sal =1001 and sal =2001 and sal --或显示成为
DEPTNO 800-2000 2001-5000 ------ ---------- ----------30 5 120 2 310 1 2 select t.deptno,"800-2000","2001-5000" from (select deptno,count(*) as "800-2000" from emp where sal between 800 and 2000 group by deptno) t join (select deptno,count(*) as "2001-5000" from emp where sal between 2001 and 5000 group by deptno) t1 on t.deptno = t1.deptno