SQL集合运算:差集、交集、并集
2014-03-27 15:12
561 查看
1、差集( except )
select a from t_a
except
select a from t_b
-- 也可写作:
select a from t_a where a not in (select a from t_b)
-- 多个字段时:
select a,b from t_a
except
select a,b from t_b
-- 多字段的查集也可写成:
select a,b from t_a where (a,b) not in (select a,b from t_b)
2、交集( intersect )
select a from t_a
intersect
select a from t_b
-- 也可写作:
select a from t_a where a in (select a from t_b)
3、并集( union )
select a from t_a
union distinct
select a from t_b
转自karen_wang
select a from t_a
except
select a from t_b
-- 也可写作:
select a from t_a where a not in (select a from t_b)
-- 多个字段时:
select a,b from t_a
except
select a,b from t_b
-- 多字段的查集也可写成:
select a,b from t_a where (a,b) not in (select a,b from t_b)
2、交集( intersect )
select a from t_a
intersect
select a from t_b
-- 也可写作:
select a from t_a where a in (select a from t_b)
3、并集( union )
select a from t_a
union distinct
select a from t_b
转自karen_wang
相关文章推荐
- SQL集合运算:差集、交集、并集
- SQL集合运算:差集、交集、并集
- SQL集合运算:差集、交集、并集
- SQL集合运算 差集 并集 交集
- SQL集合运算:差集、交集、并集
- SQL集合运算 差集 并集 交集
- SQL集合运算 差集 并集 交集
- python set集合运算(交集,并集,差集,对称差集)
- 构建一个类,对集合进行运算,包括求集合的交集,并集和差集。
- 重载运算符“+”、“*”、“-”实现集合的并集、交集、差集运算
- 重载运算符“+”、“*”、“-”实现集合的并集、交集、差集运算
- python set集合运算(交集,并集,差集,对称差集)
- 集合运算—union(并集)、intersect(交集)和except(差集)
- python set集合运算(交集,并集,差集,对称差集)
- IOS开发中集合操作 处理数据的 交集 并集 差集
- SQL 并集、差集、交集、结果集排序
- sql 交集 差集 并集 笛卡尔积
- SQL 操作结果集 -并集、差集、交集、结果集排序
- 我的SQL测试-------交集、并集、差集、笛卡尔积