zoukankan      html  css  js  c++  java
  • 左连接、右连接、内连接、外连接简单说明

    例如有两个表:

    test1:

    test2:

    内连接:(inner join on)返回两个表的交集。

    例如:

    select * from test1 a inner join test2 b on a.id=b.id;

    结果:

    外连接:返回两个表的并集。(在此就不做截图了)
     

    左连接:(left join on)根据条件返回第一个表中存在的数据。

    例如:

    select * from test1 a left join test2 b on a.id=b.id;

    结果:

    右连接:(right join on)与左连接类似,返回第二个表中存在的数据。

    例如:

    select * from test1 a RIGHT join test2 b on a.id=b.id;

    结果:

  • 相关阅读:
    p1373
    考试总结 2018-5-6
    p1044与p1898
    p1905
    p1904 p1903
    p1177
    p1273  日常打表
    p1142
    并查集与并查集模板
    p1265
  • 原文地址:https://www.cnblogs.com/0B0S/p/13708336.html
Copyright © 2011-2022 走看看