zoukankan      html  css  js  c++  java
  • Oracle SQL Lesson (8)

    集合操作符
    UNION/UNION ALL
    INTERSECT
    MINUS

    Union All不排序,不去重,其余均升序且去重。
    create table e1 as select * from emp where deptno in (10,20);
    create table e2 as select * from emp where deptno in (20,30);

    select * from e1 union select * from e2 order by 8
    select * from e1 union all select * from e2 order by 8
    select * from e1 intersect select * from e2 order by 1 desc
    select * from e1 minus select * from e2 order by 1 desc

    SELECT location_id, department_name "Department",
    TO_CHAR(NULL) "Warehouse location"
    FROM departments
    UNION
    SELECT location_id, TO_CHAR(NULL) "Department",
    state_province
    FROM locations;

    SELECT employee_id, job_id,salary
    FROM employees
    UNION
    SELECT employee_id, job_id,0
    FROM job_history;

  • 相关阅读:
    Swift
    Swift
    Swift
    Swift
    iOS
    九、原始套接字
    八、Linux下的网络服务器模型
    七、TCP/IP协议
    六、高级套接字函数
    五、用户数据报传输(UDP)
  • 原文地址:https://www.cnblogs.com/thlzhf/p/3404804.html
Copyright © 2011-2022 走看看