Sql join 表示法:这相当于内部连接还是完全连接? [英] Sql join notation: Is this equivalent to inner or full join?

查看:29
本文介绍了Sql join 表示法:这相当于内部连接还是完全连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 select  a.somefield, b.someotherfield
 from    a, b
 where   a.key = b.key

以上是否等同于:

 select  a.somefield, b.someotherfield
 from    a join b on a.key = b.key

或:

 select  a.somefield, b.someotherfield
 from    a full join b on a.key = b.key

我很确定它等同于内部联接,但刚刚意识到我以前从未真正考虑过它.另外,我想知道是否存在不是 100% 等效的边缘情况?

I am pretty sure it's equivalent to an inner join but just realized I'd never really thought about it before. Also I'm wondering if there are any edge cases where it is not 100% equivalent?

推荐答案

原来的概念等价于内连接.

The original notion is equivalent to an inner join.

使用where"语法,任何外连接(左外连接、右外连接、全外连接)都没有标准的等价物.Oracle 支持+"语法,表示左外连接和右外连接.

Using the "where" syntax, there is no standard equivalent for any of the outer joins (left outer join, right outer join, full outer join). Oracle supports a "+" syntax, to represent the left and right outer joins.

另外,在 where 子句中省略条件相当于交叉连接.

In addition, leaving out the condition in the where clause is equivalent to a cross join.

但是,您应该习惯于在 from 子句中使用连接语法.一旦习惯了它,查询的意图就会更加清晰,并且更不容易出错.

However, you should get used to using the join syntax in the from clause. Once you get used to it, it is much clearer about the intentions of the query and much less prone to error.

这篇关于Sql join 表示法:这相当于内部连接还是完全连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆