Oracle集合操作
Oracle集合运算
- 
并集
                     
在集合A和集合B中,如图代表A和B都包含。在我们的sql语句中,有两个关键字来表示这种关系,分别是:
Union和Union All
- 
union all 并集 重复
--union all 并集 重复 select * from student where gender='女' union all select * from student where sal>3000;
union 并集 不重复
--union 并集 不重复 select * from student where gender='女' union select * from student where sal<3000;
- 
交集
                       
inertsect 交集
--intersect 交集(取相同部分) select * from student where gender='男' intersect select * from student where sal<3000 intersect select * from student where name like 'J%';
- 
减集(余集)
                     
--minus 减集 select * from student minus select * from student where sal<10000;
在sql server 中用except
 
                    
                
 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号