sql92和sql99比較
1.功能方面:sql99支持的較多
2.可讀性:sql99實現了鏈接條件和篩選條件的分離,所以可讀性較高。
java
SQL92和SQL99都是用來表示多表的聯合查詢使用的,二者在開發中,具體使用哪種都是能夠的,可是在書寫和閱讀的過程當中,具體表如今如下:sql
一、笛卡爾積中的區別spa
①SQL92中的笛卡爾積:select * from emp,dept ②SQL99中的笛卡爾積:select * from emp cross join dept
二、等值鏈接方面的區別.net
①SQL92表示:select * from emp,dept where emp.deptno=dept.deptno ②SQL99表示:select * from emp innner join dept on emp.deptno=dept.deptno
三、不等值鏈接方面code
```java ①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
四、左外鏈接blog
①SQL表示:select * from emp ,dept where emp.deptno=dept.depetno(+) ②SQL99表示:select * from emp left outer join dept on emp.deptno=dept.deptno
五、右外鏈接ci
①SQL92實現:select * from emp ,depet where emp.deptno = dept.deptno; ②SQL99實現:select * from emp righ outer join dept on emp.deptno=dept.deptno
六、全完鏈接開發
①SQL92實現:select * from emp,dept where epm.deptno(+) = dept.dpetno(+) ②SQL99實現:select * from emp full outer join dept on emp.deptno=dept.deptno;
七、自鏈接it
①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
八、在三表鏈接查詢中class
①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)
部分轉載自:
https://blog.csdn.net/wyqwilliam/article/details/103076797?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.control