• 左连接,结果大于左面的表验证 解释


    create table Employees (
           last_name varchar2(10),
           department_id varchar2(10)
    );
    create table Department(
           department_id varchar2(10),
           department_name varchar2(10)
    );
    insert into Employees values ('tom','1');
    insert into Employees values ('peter','2');
    insert into Employees values ('alice','3');
    insert into Employees values ('jenny','5');
    insert into Employees values ('linda','7');
    commit;
    
    insert into Department values ('1','baidu');
    insert into Department values ('2','tensun');
    insert into Department values ('3','BTC');
    insert into Department values ('4','EOS');
    insert into Department values ('5','HSR');
    insert into Department values ('6','OMG');
    insert into Department values ('7','ETH');
    commit;
    select * from Employees;
    select * from Department  ;
    
    /*
    左连接验证(左边一共5条数据,查出来大于左边的5条,怎么解释,)
    */
    
    select e.last_name, e.department_id, d.department_name
      from Employees e
      left outer join Department d on e.department_id = d.department_id;

    LAST_NAME DEPARTMENT_ID    
    1 tom 1
    2 peter 2
    3 alice 3
    4 jenny 5
    5 linda 7

    DEPARTMENT_ID DEPARTMENT_NAME
    1 1 baidu
    2 2 tensun
    3 3 BTC
    4 4 EOS
    5 5 HSR
    6 6 OMG
    7 1 woniupp

    LAST_NAME DEPARTMENT_ID DEPARTMENT_NAME
    1 1 baidu
    2 peter 2 tensun
    3 alice 3 BTC
    4 jenny 5 HSR
    5 tom 1 woniupp
    6 linda 7

     

  • 相关阅读:
    从读者角度来看Blog
    NDuiker项目第3天
    IssueVision的List控件源码分析
    测试一个网站的想法
    IssueVision的PaneCaption控件源码分析
    技术研究的时候不要忘了“集成创新”
    人脸识别活体检测之张张嘴和眨眨眼
    jsp>Session 小强斋
    jsp>Request对象 小强斋
    jsp>四种作用域 小强斋
  • 原文地址:https://www.cnblogs.com/jycjy/p/8416605.html
Copyright © 2020-2023  润新知