程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle數據庫基礎 >> 臨時表的使用及minus運算

臨時表的使用及minus運算

編輯:Oracle數據庫基礎

----Oracle minus差運算: 打不開的網站=================================
--創建會話臨時表
drop table YKY_Website_No;
create global temporary table YKY_Website_No
(
  Website_No varchar2(10)
) on Commit Preserve Rows;

insert into YKY_Website_No(Website_No)values('FM37');
insert into YKY_Website_No(Website_No)values('FM38');
insert into YKY_Website_No(Website_No)values('FM39');
insert into YKY_Website_No(Website_No)values('FM41');
insert into YKY_Website_No(Website_No)values('FM42');
insert into YKY_Website_No(Website_No)values('FM43');
insert into YKY_Website_No(Website_No)values('FM44');
insert into YKY_Website_No(Website_No)values('FM45');
insert into YKY_Website_No(Website_No)values('FM46');
insert into YKY_Website_No(Website_No)values('FM48');
insert into YKY_Website_No(Website_No)values('FM49');
insert into YKY_Website_No(Website_No)values('FM50');
insert into YKY_Website_No(Website_No)values('FM51');
insert into YKY_Website_No(Website_No)values('FM52');
insert into YKY_Website_No(Website_No)values('FM107');
insert into YKY_Website_No(Website_No)values('FM108');
insert into YKY_Website_No(Website_No)values('FM109');
insert into YKY_Website_No(Website_No)values('FM110');
insert into YKY_Website_No(Website_No)values('FM111');
insert into YKY_Website_No(Website_No)values('FM112');
insert into YKY_Website_No(Website_No)values('FM121');
insert into YKY_Website_No(Website_No)values('NW35');
insert into YKY_Website_No(Website_No)values('NW36');
insert into YKY_Website_No(Website_No)values('NW37');
insert into YKY_Website_No(Website_No)values('NW38');
insert into YKY_Website_No(Website_No)values('NW39');
insert into YKY_Website_No(Website_No)values('NW40');
insert into YKY_Website_No(Website_No)values('NW41');
insert into YKY_Website_No(Website_No)values('NW42');
insert into YKY_Website_No(Website_No)values('NW43');
insert into YKY_Website_No(Website_No)values('BG9');
insert into YKY_Website_No(Website_No)values('BG10');
insert into YKY_Website_No(Website_No)values('BG11');
insert into YKY_Website_No(Website_No)values('BG12');
--Minus運算得到打不開的網站編號
select Website_No from YKY_Website_No
minus
select Website_No from article_detail where 
website_no in ('FM37','FM38','FM39','FM41','FM42','FM43','FM44','FM45','FM46',
'FM48','FM49','FM50','FM51','FM52','FM107','FM108','FM109','FM110','FM111','FM112','FM121',
'NW35','NW36','NW37','NW38','NW39','NW40','NW41','NW42','NW43',
'BG9','BG10','BG11','BG12'
)group by website_no having count(*)>0
order by Website_No;

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved