zoukankan      html  css  js  c++  java
  • 数据库

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

    实现: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 ...
  • 相关阅读:
    石墨文档地址
    Emacs
    HDU
    田忌赛马(贪心
    poj 3040 Allowance (贪心
    cr545
    雕塑 ( 离散化,bfs-floodfill
    求m个不相交子段的和(复杂dp
    doing home work(dp-二进制法枚举
    非常可乐(多参数bfs模拟
  • 原文地址:https://www.cnblogs.com/floakss/p/12769916.html
Copyright © 2011-2022 走看看