• <small id='0FOPX'></small><noframes id='0FOPX'>

        <bdo id='0FOPX'></bdo><ul id='0FOPX'></ul>

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

        <legend id='0FOPX'><style id='0FOPX'><dir id='0FOPX'><q id='0FOPX'></q></dir></style></legend>

        SQL Server 中左连接和右连接的区别

        Difference between left join and right join in SQL Server(SQL Server 中左连接和右连接的区别)

          <bdo id='Xz8G9'></bdo><ul id='Xz8G9'></ul>

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

                  <tfoot id='Xz8G9'></tfoot>
                • <small id='Xz8G9'></small><noframes id='Xz8G9'>

                • <legend id='Xz8G9'><style id='Xz8G9'><dir id='Xz8G9'><q id='Xz8G9'></q></dir></style></legend>
                    <tbody id='Xz8G9'></tbody>
                  本文介绍了SQL Server 中左连接和右连接的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我了解 SQL Server 中的联接.

                  I know about joins in SQL Server.

                  例如.有两个表Table1,Table2.

                  For example. There are two tables Table1, Table2.

                  它们的表结构如下.

                  create table Table1 (id int, Name varchar (10))
                  
                  create table Table2 (id int, Name varchar (10))
                  

                  表1数据如下:

                      Id     Name     
                      -------------
                      1      A        
                      2      B    
                  

                  Table2数据如下:

                  Table2 data as follows:

                      Id     Name     
                      -------------
                      1      A        
                      2      B 
                      3      C
                  

                  如果我执行下面提到的两个 SQL 语句,两个输出将是相同的

                  If I execute both below mentioned SQL statements, both outputs will be the same

                  select *
                  from Table1
                    left join Table2 on Table1.id = Table2.id
                  
                  select *
                  from Table2
                    right join Table1 on Table1.id = Table2.id
                  

                  请说明上述SQL语句中左连接和右连接的区别.

                  Please explain the difference between left and right join in the above SQL statements.

                  推荐答案

                  Select * from Table1 left join Table2 ...
                  

                  Select * from Table2 right join Table1 ...
                  

                  确实是完全可以互换的.但是尝试Table2 left join Table1(或它的相同对,Table1 right join Table2)以查看差异.这个查询应该给你更多的行,因为 Table2 包含一个 id 在 Table1 中不存在的行.

                  are indeed completely interchangeable. Try however Table2 left join Table1 (or its identical pair, Table1 right join Table2) to see a difference. This query should give you more rows, since Table2 contains a row with an id which is not present in Table1.

                  这篇关于SQL Server 中左连接和右连接的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Select n random rows from SQL Server table(从 SQL Server 表中随机选择 n 行)
                  SQL query to select dates between two dates(用于选择两个日期之间的日期的 SQL 查询)
                  How can I delete using INNER JOIN with SQL Server?(如何在 SQL Server 中使用 INNER JOIN 进行删除?)
                  Table Naming Dilemma: Singular vs. Plural Names(表命名困境:单数与复数名称)
                  INSERT statement conflicted with the FOREIGN KEY constraint - SQL Server(INSERT 语句与 FOREIGN KEY 约束冲突 - SQL Server)
                  How ROWNUM works in pagination query?(ROWNUM 如何在分页查询中工作?)
                  • <bdo id='4mhNy'></bdo><ul id='4mhNy'></ul>

                        1. <tfoot id='4mhNy'></tfoot>

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

                            <small id='4mhNy'></small><noframes id='4mhNy'>