1、A、B的交集: select * from A inner jion B on A.col = B.col
2、A、B 的对称 的差集:
select * from A full outer join B on A.col = B.col where A.col is null or B.col is null
或者
select * from A where B.col is null
join
select *from B where A.col is null
3、A、B的并集:select*from A full outer join B on A.col = B.col
4、A相对于B 的差集:select * from A LEFT join B on A.col = B.col where B.col is null
5、B相对于A 的差集:select * from A RIGHT join B on A.col = B.col where A.col is null
更多推荐
SQL语句求交集、并集、差集
发布评论