oracle中的union和union all-yellowcong
来源:互联网 发布:文娱小说推荐知乎 编辑:程序博客网 时间:2024/06/05 12:08
UNION和union all 指令的目的是将两个 SQL 语句的结果合并起来,可以查看你要的查询结果. 但是不同的是union含有distinct的功能,它会把两张表了重复的记录去掉,而union all不会,所以从效率上,union all 会高一点,但在实际中用到的并不是很多。
在进行union的时候,查询的字段,多个表要一致查询的字段相同,没有这个字段,可以用空白啥的补充,UNION在进行表链接后会筛选掉重复的记录,所以在表链接后会对所产生的结果集进行排序运算,删除重复的记录再返回结果。
例子
下面有两张完全不一样的表
SELECT * from TABLE1
SELECT * from TABLE2
Union
两个合并在一起,没有重复的数据,
SELECT kai_nen from TABLE1unionselect kai_nen from TABLE2
Union all
直接就有了重复的数据
SELECT kai_nen from TABLE1union allselect kai_nen from TABLE2
阅读全文
0 0
- oracle中的union和union all-yellowcong
- oracle中的union和union all
- Oracle中的Union、Union All
- oracle数据库中的union 和 union all 的使用
- Oracle中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Oracle 中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Oracle中的Union、Union All、Intersect、Minus
- Angular.js(四)
- Retrofit——API声明 2
- C语言编写smtp用户代理之socket操作
- ZOJ 2724 Windows Message Queue
- 缓存更新的套路
- oracle中的union和union all-yellowcong
- Hadoop+Zookeeper+HBase环境搭建
- js动态轮播图简便写法
- poj 3279
- 数据结构--------图
- UVA-70474Where is the Marble?
- 欢迎使用CSDN-markdown编辑器
- java生成excel及下载 poi
- 一道很水的题目但是会错的莫名奇妙