zoukankan      html  css  js  c++  java
  • left join,right join,join的区别

    left join:返回包括左表中的所有记录和右表中联结字段相等的记录

    right join :返回包括右表中的所有记录和左表中联结字段相等的记录

    join(inner join) : 只返回两个表中联结字段相等的行

    实例:

    1.student表

    2.score表

    3.left join 结果

    select a.name,b.subject_name,b.score from student a left join score b on a.id = b.student_id;

    4.right join 结果

    select a.name,b.subject_name,b.score from student a right join score b on a.id = b.student_id;

    5.join 结果

    select a.name,b.subject_name,b.score from student a join score b on a.id = b.student_id;

    等价于:

    select a.name,b.subject_name,b.score from student a,score b where a.id = b.student_id;

    欢迎纠错。

  • 相关阅读:
    poj 1010
    poj 1060
    poj 1001
    POJ 2769
    POJ 2559
    poj 2403
    POJ 1088
    设置全屏与退出全屏
    iframe 父子页面方法调用
    Web 前端面试小知识
  • 原文地址:https://www.cnblogs.com/chenchaochao/p/5627041.html
Copyright © 2011-2022 走看看