SQL92和SQL99都是用来表示多表的联合查询使用的,两者在开发中,具体使用哪一种都是可以的,但是在书写和阅读的过程中,具体表现在以下:

1、笛卡尔积中的区别

①SQL92中的笛卡尔积:select * from emp,dept

②SQL99中的笛卡尔积:select * from emp cross join dept

2、等值连接方面的区别

①SQL92表示:select * from emp,dept where emp.deptno=dept.deptno

②SQL99表示:select * from emp innner join dept on emp.deptno=dept.deptno

3、不等值连接方面

①SQL92表示:select * from emp ,salgrade where emp.sal<=salgrade.hisal and emp.sal>=salgrade.losal

②SQL99表示:select * from emp inner join dept on emp.deptno=dept.deptno where sal>2000

4、左外连接

①SQL表示:select * from emp ,dept where emp.deptno=dept.depetno(+)

②SQL99表示:select * from emp left outer join dept on emp.deptno=dept.deptno

5、右外连接

①SQL92实现:select * from emp ,depet where emp.deptno = dept.deptno;

②SQL99实现:select * from emp righ outer join dept on emp.deptno=dept.deptno

6、全完连接

①SQL92实现:select * from emp,dept where epm.deptno(+) = dept.dpetno(+)

②SQL99实现:select * from emp full outer join dept on emp.deptno=dept.deptno;

7、自连接

①SQL92实现:select e1.*,e2.ename from emp e1,emp e2 where e1.deptno=e2.deptno

②SQL99实现:select e1.*,e2.ename from emp e1 inner join emp e2 on e1.deptno=e2.deptno

8、在三表连接查询中

①SQL92实现:

select e.*,d.dname,c.cname
from emp e,dept d,city c
where (e.deptno=d.deptno and d.loc=c.cid and sal>2000) or (e.deptno=d.deptno and d.loc=c.cid and comm is not null)
order by e.sal
②SQL99实现:

select * from emp e
inner join dept d
on e.deptno = d.deptno
inner join city c
on d.loc =c.cid
where e.sal>2000 or e.comm is not null
order by e.sal
此外,SQL99中在内连接中还可以使用关键字:using

select * from emp inner join dept using(deptno)
————————————————
版权声明:本文为CSDN博主「道法—自然」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/wyqwilliam/article/details/103076797

原文地址:http://www.cnblogs.com/chinasoft/p/16928638.html

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长! 2. 分享目的仅供大家学习和交流,请务用于商业用途! 3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入! 4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解! 5. 如有链接无法下载、失效或广告,请联系管理员处理! 6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需! 7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员! 8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载 声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性