左连接(left join)和左外连接(left outer join)的区别

左连接vs左外连接...

左连接vs左外连接

In SQL, joins are used for the combination of records coming from different sets of data.  The 参加 can either be an inner join or an outer join.  An inner join returns records which have matches in both tables as opposed to an outer join which is the opposite of the inner. The outer join therefore returns those records that do not have matches in either table. Differences between the right outer join and the left outer join are discussed below.

差异

As noted earlier, an inner join will only produce a set of records that is present in two tables that are being compared.  A full outer join, on the other hand, is one that produces the complete set of all the records present in both tables under comparison.  In the event that there are no matches, the missing matches will contain a null.

A left outer join will contain a full set of records that come from the first table and the matching results will be available with its results in the corresponding table. In the event there are no matching results, the right side will contain a null. To produce the records in the left table only, and not the right table,  use of a ‘where’ clause comes into play.

To produce unique records for the table on the right and the one on the left, use of a full outer join is recommended. Having performed the full outer join, a “where” clause is used to exclude results that are unwanted both from the “right” and the “left” side. Furthermore, a Cartesian join can be used to help join everything left and right. This may at times not be what is being sought for, but is what sometimes appears. The joins produce a powerful data set which gives up to 16 rows of data sets, often much more than is anticipated.  Although you get a massive amount of data sets, these joins are extremely dangerous as a slight incompatibility can cripple the entire system.

If you are dealing with a project that also seeks the compatibility of Microsoft SQL server, then there will be benefits derived from the use of the left outer join. The return sequence starts off with inner records being returned first, followed by right join records and finally a join of the left records. Use of the left join or left outer join statement in the SQL environment will refer to the exact same statement. This in essence means that there is no difference as to the result expected whether a left join is used or a left outer join is used. The result will be similar, unless the environment is in the Microsoft SQL server. The outer keyword can be used or even omitted without 担心 as the results do not differ in any way.

摘要

Joins are used in SQL to compare different sets of data

An inner join only produces a set of records that is present in two tables that are being compared

An outer join produces the complete set of all the records present in both tables under study

A ‘where’ clause used to produce unique records after use of a full join

A Cartesian join links both left and right elements of a table.

There is a notable difference where left join and left outer join used when using Microsoft SQL server

All in all, use of the left join or left outer join statement refers to the exact same statement. Since there is no difference, the use of the left outer join is recommended.

  • 发表于 2021-06-24 11:48
  • 阅读 ( 367 )
  • 分类:IT

你可能感兴趣的文章

他的一捆(bundle of his)和浦肯野纤维(purkinje fibres)的区别

...门用于快速脉冲传导。为了做到这一点,他们有许多间隙连接和宽直径。此外,他们有较少的肌原纤维和没有T管。然而,它们含有大量的糖原和线粒体。最重要的是,浦肯野纤维比心肌细胞大。 他的一捆(bundle of his)和浦肯野纤...

  • 发布于 2020-09-28 09:27
  • 阅读 ( 634 )

upgma公司(upgma)和邻接连接树(neighbor joining tree)的区别

UPGMA和邻接连接树的关键区别在于每种方法产生的系统进化树的类型。UPGMA是构建有根系统发育树的技术,邻接连接树是构建无根系统发生树的技术。 系统发育树是一种树状图,显示了生物体之间的进化关系。一个系统进化树...

  • 发布于 2020-10-15 16:37
  • 阅读 ( 918 )

正确的(right)和左心房(left atrium)的区别

右心房和左心房的关键区别在于右心房接受来自身体的脱氧血液,而左心房则从肺中接收含氧血液。 人的心脏有四个肌室:两个心房和两个心室。上心房是两个接受血液的心房。位于心脏右侧的心房为右心房,而位于心脏左...

  • 发布于 2020-10-17 09:13
  • 阅读 ( 1222 )

正确的(right)和左支气管(left bronchus)的区别

...端分成两个分支:左右分支,这就是主支气管,右支气管和左支气管。因此,每个支气管的主要功能是将空气从气管输送到肺部。 目录 1. 概述和主要区别 2. 什么是右支气管 3. 什么是左支气管 4. 左右支气管的相似性 5. 并列比较...

  • 发布于 2020-10-18 01:02
  • 阅读 ( 351 )

内部联接(inner join)和自然连接(natural join)的区别

...目录 1. 概述和主要区别 2. 什么是内部联接 3. 什么是自然连接 4. 内联接与自然联接的关系 5. 并排比较-表格形式的内部连接与自然连接 6. 摘要 什么是内部联接(inner join)? 内部联接的示例如下。下面是学生桌。 学生信息表如下...

  • 发布于 2020-10-18 12:15
  • 阅读 ( 1699 )

右侧(right sided)和左心衰竭(left sided heart failure)的区别

...腔功能不全而引起的,则称为左心衰竭。这就是右心衰竭和左心衰的区别。 目录 1. 概述和主要区别 2. 什么是右心衰竭 3. 什么是左心衰竭 4. 左、右心衰的相似性 5. 并列比较-右心衰竭与左心衰的表格形式 6. 摘要 什么是右心衰竭...

  • 发布于 2020-10-20 08:14
  • 阅读 ( 185 )

左边(left)和心脏右侧(right side of heart)的区别

...右心脏的主要区别在于,心脏的左侧由富氧血液的左心房和左心室组成,而心脏的右侧则由含氧量低的右心房和右心室组成。 人的心脏是肌肉的;四腔是一个惊人的**,由两个心室和两个心房组成。它大约有拳头大小,位于胸骨...

  • 发布于 2020-10-25 01:55
  • 阅读 ( 679 )

正确的(right)和左肺(left lung)的区别

右肺和左肺的关键区别在于右肺由三个肺叶组成,而左肺由两个肺叶组成。右肺通过两根支气管与气管相连,而左肺通过一根支气管与气管相连。 肺是许多动物呼吸系统中最大的**。人的肺是一对锥形**,位于膈上的胸腔里。...

  • 发布于 2020-11-03 09:48
  • 阅读 ( 430 )

所有程序员都应该知道的13条最重要的sql命令

... join命令用于连接存储在一个或多个表中的相关数据。将第二个表连接到第一个表,并指定数据的连接方式。下面是一个基本示例: ...

  • 发布于 2021-03-14 06:57
  • 阅读 ( 220 )

如何使用sql连接一次查询多个数据库表

... MySQL数据库中使用的默认连接称为内部连接,这是最常见和最直接的连接。此联接返回两个表中都有匹配记录的所有记录,并取消所有其他记录。 ...

  • 发布于 2021-03-27 04:02
  • 阅读 ( 293 )
sfq75403
sfq75403

0 篇文章

相关推荐