LEFT JOIN vs. LEFT OUTER JOIN in SQL Server(SQL Server 中的 LEFT JOIN 与 LEFT OUTER JOIN)
问题描述
LEFT JOIN 和 LEFT OUTER JOIN 有什么区别?
推荐答案
根据文档:FROM (Transact-SQL):
<join_type> ::=
[ { INNER | { { LEFT | RIGHT | FULL } [ OUTER ] } } [ <join_hint> ] ]
JOIN
关键字OUTER 被标记为可选(括在方括号中).在这种特定情况下,是否指定 OUTER 没有区别.请注意,虽然 join 子句的其他元素也被标记为可选,但将 它们 排除在外 将 有所作为.
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 子句的整个类型部分是可选的,在这种情况下,如果您只指定 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQL Server 中的 LEFT JOIN 与 LEFT OUTER JOIN
基础教程推荐
- 在多列上分布任意行 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
