UNION 及 UNION ALL
UNION :列名,数据类型要一致,结果会默认ASC自动排序
UNION ALL :结果不会去重,不排序,其他和UNION一样
用类似to_char(null), to_number(null), to_date(null) 来填充缺列的情况;
如:
select job_id
from employees
UNION
select job_id
from retired_employees
成都创新互联是一家企业级云计算解决方案提供商,超15年IDC数据中心运营经验。主营GPU显卡服务器,站群服务器,绵阳服务器托管,海外高防服务器,大带宽服务器,动态拨号VPS,海外云手机,海外云服务器,海外服务器租用托管等。
如:
select job_id,department_id
from employees
UNION ALL
select job_id,department_id
from retired_employees
order by job_id;
intersect 取交集
结果会排序,会去重
如:
select manager_id,department_id
from employees
INTERSECT
select manager_id,department_id
from retired_employees;
MINUS 前select的结果减去和后select的去重复的结果
如:
select employee_id, job_id
from employees
where department_id=80
MINUS
select employee_id, job_id
from retired_employees
where department_id=90
以上4种输出结果都只关心第1条select的定义
order by 只能放在最后,且只能出现1次,且不能放在子查询里。
parenthes 括号可以更改执行优先级。
新闻标题:Oracle_071_lesson_p9
网页路径:https://www.cdcxhl.com/article32/jsijpc.html
成都网站建设公司_创新互联,为您提供网站设计、服务器托管、、网站设计公司、全网营销推广、网站内链
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联