oracle union all
时间: 2023-11-25 07:06:58 浏览: 81
oracle集合union、union all、intersect、minus
在Oracle中,UNION ALL是用来合并两个或多个SELECT语句的结果集,并返回所有的行,包括重复的行。 UNION ALL并不会对重复的行进行去重处理。而UNION操作符则会自动去除重复的行。
举个例子,如果我们有两个表STUDENT和STUDENT2,分别包含学生的姓名,我们可以使用UNION ALL操作符来合并两个表的结果集,示例代码如下:
```
select stuname as name from STUDENT
union all
select name from STUDENT2;
```
运行上述SQL语句后将会返回一个包含所有学生姓名的结果集,包括重复的姓名。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Oracle 中 union 和union all 的简单使用说明](https://blog.csdn.net/ZhangTJ_one/article/details/80463400)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [【ORACLE】Oracle提高篇之UNION&UNION ALL](https://blog.csdn.net/sdut406/article/details/83215355)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文