zoukankan      html  css  js  c++  java
  • 内连接、外连接、左连接、右连接

    1) 内连接  
      select   a.*,b.*   from   a   inner   join   b     on   a.id=b.parent_id      
      结果是    
      1   张3                   1     23     1  
      2   李四                  2     34     2  

      2)左连接  
      select   a.*,b.*   from   a   left   join   b     on   a.id=b.parent_id      
      结果是    
      1   张3                   1     23     1  
      2   李四                  2     34     2  
      3   王武                  null  

     3) 右连接  
      select   a.*,b.*   from   a   right   join   b     on   a.id=b.parent_id      
      结果是    
      1   张3                   1     23     1  
      2   李四                  2     34     2  
      null                       3     34     4  

     4) 完全连接  
      select   a.*,b.*   from   a   full   join   b     on   a.id=b.parent_id  
      结果是    
      1   张3                  1     23     1  
      2   李四                 2     34     2  
      null                   3     34     4  
      3   王武                 null

  • 相关阅读:
    LeetCode#13罗马数字转整数
    LeetCode#7整数反转
    LeetCode#1两数之和
    LeetCode#26删除排序数组中的重复项
    LeecCode#1550存在连续三个奇数的数组
    LeetCode#228汇总区间
    LeetCode#1476子矩形查询
    LeetCode#1535找出数组游戏的赢家
    LeetCode#867转置矩阵
    Vue源码——摸着石头过河
  • 原文地址:https://www.cnblogs.com/fthjane/p/4815530.html
Copyright © 2011-2022 走看看