1. 程式人生 > >集合操作

集合操作

family history spa pan min 重復值 all align employ

select employee_id, job_id from employees

union all

select employee_id, job_id from job_history;

select employee_id, job_id from employees

union

select employee_id, job_id from job_history; 沒有重復值 觸發排序

select employee_id, job_id from employees

intersect

select employee_id, job_id from job_history;

select employee_id from employees

minus

select employee_id from job_history;

select employee_id, job_id, salary from employees

union all

select employee_id, job_id, null from job_history;

select employee_id, job_id, to_char(salary) from employees

union all

select employee_id, job_id, ‘no salary‘ from job_history;

集合排序:

select employee_id, job_id, salary from employees

union all

select employee_id, job_id, null from job_history

order by salary;

select employee_id, job_id, null from job_history

union all

select employee_id, job_id, salary from employees

order by 3;

集合操作