0%

SQL99 和 SQL92 的区别

这里主要说一下两者关于JOIN方面的区别:

SQL 92

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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

SQL 99

1
2
3
4
5
6
7
8
9
10
11
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 标准,因为层次性更强,可读性更强。

欢迎关注我的其它发布渠道