zoukankan      html  css  js  c++  java
  • 数据库>SQL Server2005>小实例>内连接,左连接,右连接,全连接

    表link1数据:

    ida

    1

    2

    表link2数据:

    idb

    2

    3

    查询语句如下:

    --内连接
    select * from link1 a join link2 b on a.ida=b.idb
    ida                   idb                  
    -----------   -----------  
    2                       2

    --左连接
    select * from link1 a left join link2 b on a.ida=b.idb
    ida                   idb                  
    -----------   -----------  
    1                       NULL
    2                       2

    --右连接
    select * from link1 a right join link2 b on a.ida=b.idb

    ida                   idb                  
    -----------   -----------  
    2                       2
    NULL                 3

    --全连接
    select * from link1 a full join link2 b on a.ida=b.idb

    ida                   idb                  
    -----------   -----------  
    2                       2
    NULL                 3
    1                       NULL


    合乎自然而生生不息。。。
  • 相关阅读:
    DataTable.AcceptChanges方法有何用处
    中山西路620号 的人才服务中心搬到 梅园路77号去了
    Congos
    ps -aux返回超过100%
    to_date如何处理毫秒?
    SNMP_802.1
    交换机
    Oracle字符编码
    CRON
    交换机
  • 原文地址:https://www.cnblogs.com/samwu/p/2082427.html
Copyright © 2011-2022 走看看