----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;
--创建会话临时表
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;