full join no满连接的使用

Posted 妤轩

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了full join no满连接的使用相关的知识,希望对你有一定的参考价值。


查询各个部门工资范围,按照1000~2000,2000~3000.。。。这样的格式显示人数

select * from (select job,count(*) as "1000~2000" from
(select sal,job from emp
where sal<=2000 and sal>=1000)
group by job) a
full join
(select job,count(*) as "2000~3000" from
(select sal,job from emp
where sal<=3000 and sal>2000)
group by job) b
on a.job=b.job
full join (select job,count(*) as "3000~4000" from
(select sal,job from emp
where sal<=4000 and sal>3000)
group by job) c
on b.job=c.job
full join  (select job,count(*) as "4000~5000" from
(select sal,job from emp
where sal<=5000 and sal>4000)
group by job) d
on d.job=c.job

以上是关于full join no满连接的使用的主要内容,如果未能解决你的问题,请参考以下文章

FULL OUTER JOIN 不能在没有连接两边的字段相等的条件下使用

Mysql 连接(left join, right join, inner join ,full join)

外连接(left join、full join、right join)与内连接(inner join)的区别

SQL表连接查询(inner join(join)full joinleft joinright join)

如果没有条件与连接两侧的字段相等,则不能使用FULL OUTER JOIN

Oracle表与表之间的连接方式(内连接:inner join 外连接 全连接: full outer join左连接:left outer join 右连接:right outer join(代码