zoukankan      html  css  js  c++  java
  • inner join、left join、right join中where和and的作用

    inner join、left join、right join中where和and的作用

    1、内连接(自然连接): 只有两个表相匹配的行才能在结果集中出现
    2、外连接: 包括

     (1)左外连接 (左边的表不加限制
    )

       select a.studentno, a.studentname, b.classname
       from students a, classes b where a.classid = b.classid(+);
     (2)右外连接(右边的表不加限制
    )

       select a.studentno, a.studentname, b.classname
       from students a, classes b where a.classid(+) = b.classid
     (3)全外连接(左右两表都不加限制)

    即:
    左连接显示左边全部的和右边与左边相同的
    右连接显示右边全部的和左边与右边相同的

    内连接是只显示满足条件的
    !

     

    3.inner join(等值连接) 只返回两个表中联结字段相等的行,where和and条件都对整体查询结果有影响。

     

    4.left join(左联接) 返回包括左表中的所有记录和右表中联结字段相等的记录,right join(右联接) 返回包括右表中的所有记录和左表中联结字段相等的记录,这里一并讨论:

    where条件可以对整体查询结果进行筛选,而and只会对连接的表进行筛选。

  • 相关阅读:
    mysql安装(docker)
    Spark安装(standalone)
    hbase安装
    hadoop安装
    TICK/TIGK运维栈安装运行 docker-compose【下】
    域名解析
    Windows下的maven项目部署在Linux服务器
    SpringMVC访问静态资源和WEB-INF下的JSP文件
    Linux执行SQL文件
    远程访问Tomcat 403 Access Denied
  • 原文地址:https://www.cnblogs.com/keanuyaoo/p/3317969.html
Copyright © 2011-2022 走看看