UNION 及 UNION ALL
UNION :列名,數(shù)據(jù)類型要一致,結(jié)果會(huì)默認(rèn)ASC自動(dòng)排序
UNION ALL :結(jié)果不會(huì)去重,不排序,其他和UNION一樣
用類似to_char(null), to_number(null), to_date(null) 來(lái)填充缺列的情況;
如:
select job_id
from employees
UNION
select job_id
from retired_employees
成都創(chuàng)新互聯(lián)是一家企業(yè)級(jí)云計(jì)算解決方案提供商,超15年IDC數(shù)據(jù)中心運(yùn)營(yíng)經(jīng)驗(yàn)。主營(yíng)GPU顯卡服務(wù)器,站群服務(wù)器,綿陽(yáng)服務(wù)器托管,海外高防服務(wù)器,大帶寬服務(wù)器,動(dòng)態(tài)撥號(hào)VPS,海外云手機(jī),海外云服務(wù)器,海外服務(wù)器租用托管等。
如:
select job_id,department_id
from employees
UNION ALL
select job_id,department_id
from retired_employees
order by job_id;
intersect 取交集
結(jié)果會(huì)排序,會(huì)去重
如:
select manager_id,department_id
from employees
INTERSECT
select manager_id,department_id
from retired_employees;
MINUS 前select的結(jié)果減去和后select的去重復(fù)的結(jié)果
如:
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種輸出結(jié)果都只關(guān)心第1條select的定義
order by 只能放在最后,且只能出現(xiàn)1次,且不能放在子查詢里。
parenthes 括號(hào)可以更改執(zhí)行優(yōu)先級(jí)。
新聞標(biāo)題:Oracle_071_lesson_p9
網(wǎng)頁(yè)路徑:http://chinadenli.net/article32/jsijpc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)、服務(wù)器托管、、網(wǎng)站設(shè)計(jì)公司、全網(wǎng)營(yíng)銷推廣、網(wǎng)站內(nèi)鏈
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)