zoukankan      html  css  js  c++  java
  • 左连接,结果大于左面的表验证 解释

    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

     

  • 相关阅读:
    用java批量重命名文件
    登入Tomcat Manager时出现401错误——解决方法
    bat启动/停止oracle服务
    java基本类型与字符串之间的转换
    java面向对象 要点
    理解main 方法
    第二章 变量,数据类型和运算符
    初始JAVA
    jdbcTemplate
    Aspectj
  • 原文地址:https://www.cnblogs.com/jycjy/p/8416605.html
Copyright © 2011-2022 走看看