floakss

目的:  两张表中数据联系起来查询符合条件的数据(笛卡尔积)

实现:SQL语句

(1)内连接:join xxx on xxx
    1 等值连接
        select 
              xxx 
        from  
            table1 
        (inner:表示内连接,可省略)join 
            table2 
        on
            xxx=xxx (链接条件)
        where(数据过滤)
            xxx=xxx ;
    2 非等值链接
        select 
              xxx 
        from  
            table1 
        (inner:表示内连接,可省略)join 
            table2 
        on
            (链接条件)变为:xxx between xxx and xxx
        where(数据过滤)
            xxx=xxx ;
    3 自链接
2)外连接:
    特点:一条一条匹配链接时,自动填充null匹配链接的表中没有的数据;与内连接相比查询记录条数多;
   1 左外链接
将join左边的表中的数据全部找出来
select .. from ... left (outer:可省略) join ... on ... where ...
2 右外链接
将join左边的表中的数据全部找出来
select .. from ... right (outer) join ... on ... where ...

 

分类:

技术点:

相关文章:

  • 2021-12-26
  • 2021-08-09
  • 2021-10-09
  • 2021-11-03
  • 2021-11-03
  • 2021-09-17
  • 2021-09-07
  • 2021-11-03
猜你喜欢
  • 2021-12-05
  • 2021-12-15
  • 2021-12-05
  • 2021-12-15
  • 2021-09-29
  • 2021-12-03
相关资源
相似解决方案