-- intersect(A ∩ B)。交集select*from student where id in(1,2,3)intersectselect*from student where id in(2,3,4);-- 变通实现select*from student where id in(1,2,3)and id in(select id from student where id in(2,3,4));
3.4. 差集minus
oracle支持,mysql不支持(可以变通实现)
3.4.1.左差集minus(A - B)
-- minus(A - A ∩ B)。左差集select*from student where id in(1,2,3)
minus
select*from student where id in(2,3,4);-- 变通实现select*from student where id in(1,2,3)and id notin(select id from student where id in(2,3,4));
3.4.2 右差集minus(B - A)
-- minus(A - A ∩ B)。右差集select*from student where id in(2,3,4)
minus
select*from student where id in(1,2,3);-- 变通实现select*from student where id in(2,3,4)and id notin(select id from student where id in(1,2,3));
3.5. 并集union(A ∪ B)
-- union(A ∪ B)。并集(去重)select*from student where id in(1,2,3)unionselect*from student where id in(2,3,4);
3.6. 和集 union all(A + B)
-- union all(A + B)。和集(不去重)select*from student where id in(1,2,3)unionallselect*from student where id in(2,3,4);
3.7. 补集(A minus B) union (B minus A)[(A - B) ∪ (B - A)]或 (A union B) minus (A intersect B)[(A ∪ B) - (A ∩ B)] 。A ∩ B在A ∪ B的补集。
oracle支持,mysql不支持(可以变通实现)
-- 算法1:`(A minus B) union (B minus A)`[(A - B) ∪ (B - A)]。A ∩ B在A ∪ B的补集。(select*from student where id in(1,2,3)
minus
select*from student where id in(2,3,4))union(select*from student where id in(2,3,4)
minus
select*from student where id in(1,2,3));-- 算法1:变通实现(select*from student where id in(1,2,3)and id notin(select id from student where id in(2,3,4)))union(select*from student where id in(2,3,4)and id notin(select id from student where id in(1,2,3)));-- 算法2:`(A union B) minus (A intersect B)`[(A ∪ B) - (A ∩ B)] -- `(union) minus (intersect)`[(A ∪ B) - (A ∩ B)]。A ∩ B在A ∪ B的补集。(select*from student where id in(2,3,4)unionselect*from student where id in(1,2,3))
minus
(select*from student where id in(2,3,4)intersectselect*from student where id in(1,2,3));-- 算法2:变通实现select*from(select*from student where id in(1,2,3)unionselect*from student where id in(2,3,4))where id notin(select id from student where id in(1,2,3)and id in(select id from student where id in(2,3,4)));
把背景调黑,把曲线调黄,把grid调白,调调字体字号的操作
close all
a0:0.1:10;
noise2*rand(1,length(a));
bsin(a)sin(3*a)noise;plot(a,b,y,linewidth,2);
ylim([-3 4]) %y轴范围
set(gca,xgrid,on,ygrid,on,gridlinestyle,-,Grid…