<tfoot id='qwmx1'></tfoot>

    • <bdo id='qwmx1'></bdo><ul id='qwmx1'></ul>

    <legend id='qwmx1'><style id='qwmx1'><dir id='qwmx1'><q id='qwmx1'></q></dir></style></legend>
  1. <small id='qwmx1'></small><noframes id='qwmx1'>

      <i id='qwmx1'><tr id='qwmx1'><dt id='qwmx1'><q id='qwmx1'><span id='qwmx1'><b id='qwmx1'><form id='qwmx1'><ins id='qwmx1'></ins><ul id='qwmx1'></ul><sub id='qwmx1'></sub></form><legend id='qwmx1'></legend><bdo id='qwmx1'><pre id='qwmx1'><center id='qwmx1'></center></pre></bdo></b><th id='qwmx1'></th></span></q></dt></tr></i><div id='qwmx1'><tfoot id='qwmx1'></tfoot><dl id='qwmx1'><fieldset id='qwmx1'></fieldset></dl></div>

      join语句的操作顺序

      Join statement order of operation(join语句的操作顺序)
        <tbody id='g1wWm'></tbody>
        <i id='g1wWm'><tr id='g1wWm'><dt id='g1wWm'><q id='g1wWm'><span id='g1wWm'><b id='g1wWm'><form id='g1wWm'><ins id='g1wWm'></ins><ul id='g1wWm'></ul><sub id='g1wWm'></sub></form><legend id='g1wWm'></legend><bdo id='g1wWm'><pre id='g1wWm'><center id='g1wWm'></center></pre></bdo></b><th id='g1wWm'></th></span></q></dt></tr></i><div id='g1wWm'><tfoot id='g1wWm'></tfoot><dl id='g1wWm'><fieldset id='g1wWm'></fieldset></dl></div>
        <legend id='g1wWm'><style id='g1wWm'><dir id='g1wWm'><q id='g1wWm'></q></dir></style></legend>
      1. <small id='g1wWm'></small><noframes id='g1wWm'>

            <bdo id='g1wWm'></bdo><ul id='g1wWm'></ul>
            <tfoot id='g1wWm'></tfoot>
                本文介绍了join语句的操作顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                给定以下 3 种方式加入

                Given the following 3 way join

                select t1.* from t1
                left join t2 on t1.fk = t2.pk
                join t3 on t2.fk = t3.pk
                

                如果 t2 和 t3 之间的连接失败,是否会返回 t1 和 t2 之间成功连接的行?如果操作顺序是从左到右,我假设不是,但如果它是从右到左计算的(t3 先连接到 t2),那么即使前者失败,t1 仍将返回.

                If the join between t2 and t3 failed, would the row from the successful join between t1 and t2 be returned? If the order of operation goes from left to right, I assume not, but if it's evaluated from right to left (t3 is joined to t2 first) then t1 will still be returned even when the former failed.

                它是如何工作的?

                推荐答案

                ON 子句的位置控制评估的逻辑顺序.

                The placement of the ON clauses controls the logical order of evaluation.

                所以首先 t1 LEFT JOIN t2 ON t1.fk = t2.pk 发生.此连接的结果是一个包含 t1, t2 中所有匹配行的虚拟表,并且(因为它是左外连接)任何不匹配的 t1 行也被保留t2 列的空值.

                So first the t1 LEFT JOIN t2 ON t1.fk = t2.pk happens. The result of this join is a virtual table containing all the matching rows from t1, t2 and (because it is a left outer join) any non matched t1 rows are also preserved with null values for the t2 columns.

                这个虚拟表然后参与下一个连接.在 t2.fk = t3.pk 上加入 t3

                This virtual table then participates in the next join. JOIN t3 ON t2.fk = t3.pk

                任何与 t1 中的行不匹配的 t2 记录都不是第一阶段的虚拟表输出的一部分,因此不会出现在最终结果中.此外,在 t2.fk = t3.pk 上的这个内部连接将丢失 t2.fk 的任何 NULL 值,有效地将你的整个事情重新变成内部加入.

                Any t2 records that do not match rows in t1 are not part of the virtual table output from the first stage so won't appear in the final result. Additionally this inner join on t2.fk = t3.pk will lose any NULL values of t2.fk effectively turning your whole thing back into inner joins.

                逻辑查询处理解释得很好作者:Itzik Ben Gan 在这里

                Logical Query Processing is explained well by Itzik Ben Gan here

                这篇关于join语句的操作顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                SQL query to group by day(按天分组的 SQL 查询)
                What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                <i id='KidrO'><tr id='KidrO'><dt id='KidrO'><q id='KidrO'><span id='KidrO'><b id='KidrO'><form id='KidrO'><ins id='KidrO'></ins><ul id='KidrO'></ul><sub id='KidrO'></sub></form><legend id='KidrO'></legend><bdo id='KidrO'><pre id='KidrO'><center id='KidrO'></center></pre></bdo></b><th id='KidrO'></th></span></q></dt></tr></i><div id='KidrO'><tfoot id='KidrO'></tfoot><dl id='KidrO'><fieldset id='KidrO'></fieldset></dl></div>

                    <legend id='KidrO'><style id='KidrO'><dir id='KidrO'><q id='KidrO'></q></dir></style></legend>

                    <small id='KidrO'></small><noframes id='KidrO'>

                        <tbody id='KidrO'></tbody>
                      <tfoot id='KidrO'></tfoot>
                      • <bdo id='KidrO'></bdo><ul id='KidrO'></ul>