left join
right join
inner join
outer join

解决方案 »

  1.   

    1,left join
    2,right join
    3,inner join
    4,outer join5,
    select * from table1
    union all
    select * from table2
      

  2.   

    1,两表的左连接查询结果;    空
    2,两表的右连接查询结果;       空  
    3,两表的内连接查询结果;    空
    4,两表的外连接查询结果;   
    --------------------------------    cl1  cl2  cl3 cl1  cl2  cl3      a    b    c  null null null
          d    e    f  null null null
          g    h    i null null null
                         
          null null null  j    k    l
          null null null m    n    o
          null null null  p    q    w5,两表的联合查询结果. 
    -------------------------------
         cl1  cl2  cl3
          a    b    c
          d    e    f
          g    h    i
           j    k    l
           m    n    o
           p    q    w
      

  3.   

    --给你这个参考吧--关于连接的简单示例--测试数据
    declare @a table(ida int)
    insert @a select 1
    union all select 2declare @b table(idb int)
    insert @b select 2
    union all select 3--内连接
    select * from @a a join @b b on a.ida=b.idb/*--测试结果
    只返回两个表中ida与idb相同的记录
    ida         idb         
    ----------- ----------- 
    2           2(所影响的行数为 1 行)
    --*/
    --左连接
    select * from @a a left join @b b on a.ida=b.idb/*--测试结果
    返回@a(左边表)所有的记录,及@b的idb与@a的ida对应的记录
    没有对应的就用null表示ida         idb         
    ----------- ----------- 
    1           NULL
    2           2(所影响的行数为 2 行)
    --*/
    --右连接
    select * from @a a right join @b b on a.ida=b.idb/*--测试结果
    返回@b(右边表)所有的记录,及@b的idb与@a的ida对应的记录
    没有对应的就用null表示ida         idb         
    ----------- ----------- 
    2           2
    NULL        3(所影响的行数为 2 行)
    --*/
    --全连接
    select * from @a a full join @b b on a.ida=b.idb/*--测试结果
    返回@a与@b的所有记录,没有对应的用NULL表示ida         idb         
    ----------- ----------- 
    2           2
    NULL        3
    1           NULL(所影响的行数为 3 行)
    --*/
      

  4.   

    内连接=连接=join =innser join外连接=
    left join
    right join
    full join