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

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

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

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

      MySQL:连接类型的快速细分

      时间:2023-08-17

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

        • <bdo id='GIr0x'></bdo><ul id='GIr0x'></ul>
            <legend id='GIr0x'><style id='GIr0x'><dir id='GIr0x'><q id='GIr0x'></q></dir></style></legend>
              1. <tfoot id='GIr0x'></tfoot>

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

                  <tbody id='GIr0x'></tbody>
                本文介绍了MySQL:连接类型的快速细分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我想快速了解一下 MySQL 连接的类型.我知道这些,其余的我不确定它们是什么意思.

                I would like a quick breakdown of the types of MySQL joins. I know of these, the rest I am not sure what they mean.

                • 逗号分隔(究竟是什么?):SELECT * FROM a, b WHERE b.id = a.beeId AND ...
                • 显示来自 a 的信息,即使 b 中没有匹配项:SELECT * FROM a LEFT OUTER JOIN b ON b.id = a.beeId WHERE ...
                • comma separated (what exactly is this short for?): SELECT * FROM a, b WHERE b.id = a.beeId AND ...
                • show information from a, even if there are no matches in b: SELECT * FROM a LEFT OUTER JOIN b ON b.id = a.beeId WHERE ...

                我见过其他连接,但想知道是什么让它们不同,什么是 INNER/OUTER,添加 LEFT 会改变什么.

                I have seen other joins, but want to know what makes them different, what is INNER/OUTER, does adding LEFT change things.

                我已经知道连接是如何工作的,我只想知道是否还有其他类型的连接,或者它们是否只是获得相同结果的不同方式.

                I already know how joins work, I just want to know if there are other types of joins, or if they are just different ways to get the same result.

                推荐答案

                根据您的评论,最好在 W3Schools<上找到每个方案的简单定义/a>每种类型的第一行对连接类型进行了简要说明

                Based on your comment, simple definitions of each is best found at W3Schools The first line of each type gives a brief explanation of the join type

                • JOIN:当两个表中至少有一个匹配项时返回行
                • LEFT JOIN:返回左表中的所有行,即使右表中没有匹配项
                • RIGHT JOIN:返回右表中的所有行,即使左表中没有匹配项
                • FULL JOIN:当其中一个表中有匹配项时返回行

                结束编辑

                简而言之,你给出的逗号分隔的例子

                In a nutshell, the comma separated example you gave of

                SELECT * FROM a, b WHERE b.id = a.beeId AND ...
                

                从表 a 和 b 中选择每条记录,用逗号分隔表,这也可以用在像

                is selecting every record from tables a and b with the commas separating the tables, this can be used also in columns like

                SELECT a.beeName,b.* FROM a, b WHERE b.id = a.beeId AND ...
                

                然后在您的示例中 b.id 列和 a.beeId 列匹配的行中获取指示信息.因此,在您的示例中,它将从表 a 和 b 中获取所有信息,其中 b.id 等于 a.beeId.在我的示例中,当 b.id 等于 a.beeId 时,它将从 b 表中获取所有信息,并且仅从 a.beeName 列中获取信息.请注意,还有一个 AND 子句,这将有助于优化您的结果.

                It is then getting the instructed information in the row where the b.id column and a.beeId column have a match in your example. So in your example it will get all information from tables a and b where the b.id equals a.beeId. In my example it will get all of the information from the b table and only information from the a.beeName column when the b.id equals the a.beeId. Note that there is an AND clause also, this will help to refine your results.

                有关 mySQL 联接和左联接的一些简单教程和解释,请查看 Tizag 的 mySQL 教程.您还可以查看 Keith J. Brown 的网站,了解有关连接的更多信息,这也很不错.

                For some simple tutorials and explanations on mySQL joins and left joins have a look at Tizag's mySQL tutorials. You can also check out Keith J. Brown's website for more information on joins that is quite good also.

                希望对你有帮助

                这篇关于MySQL:连接类型的快速细分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:ERROR 2006 (HY000): MySQL 服务器已经消失 下一篇:启用远程 MySQL 连接:ERROR 1045 (28000): Access denied f

                相关文章

                最新文章

                <legend id='lHBM0'><style id='lHBM0'><dir id='lHBM0'><q id='lHBM0'></q></dir></style></legend>
              2. <tfoot id='lHBM0'></tfoot>
              3. <small id='lHBM0'></small><noframes id='lHBM0'>

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