SQL Server中的LEFT JOIN与LEFT OUTER JOIN [英] LEFT JOIN vs. LEFT OUTER JOIN in SQL Server
问题描述
LEFT JOIN
和LEFT OUTER JOIN
有什么区别?
推荐答案
根据文档:关键字OUTER
被标记为可选(括在方括号中).在这种特定情况下,是否指定OUTER
都没有区别.请注意,尽管join子句的其他元素也被标记为可选元素,但将 them 保留为会有所不同.
The keyword OUTER
is marked as optional (enclosed in square brackets). In this specific case, whether you specify OUTER
or not makes no difference. Note that while the other elements of the join clause is also marked as optional, leaving them out will make a difference.
例如,JOIN
子句的整个type-part是可选的,在这种情况下,如果您仅指定JOIN
,则默认值为INNER
.换句话说,这是合法的:
For instance, the entire type-part of the JOIN
clause is optional, in which case the default is INNER
if you just specify JOIN
. In other words, this is legal:
SELECT *
FROM A JOIN B ON A.X = B.Y
以下是等效语法的列表:
Here's a list of equivalent syntaxes:
A LEFT JOIN B A LEFT OUTER JOIN B
A RIGHT JOIN B A RIGHT OUTER JOIN B
A FULL JOIN B A FULL OUTER JOIN B
A INNER JOIN B A JOIN B
还要看看我在另一个SO问题上留下的答案: SQL左联接与FROM行上的多个表吗?.
Also take a look at the answer I left on this other SO question: SQL left join vs multiple tables on FROM line?.
这篇关于SQL Server中的LEFT JOIN与LEFT OUTER JOIN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!