当前位置:网站首页>What is the difference between union and union all
What is the difference between union and union all
2022-06-12 19:50:00 【WD Technology】
UNION The operator is used to merge two or more SELECT The result set of the statement .
Please note that ,UNION Inside SELECT Statements must have the same number of columns . Columns must also have similar data types . meanwhile , Every one of them SELECT The order of the columns in the statement must be the same .
Union: Combine two result sets , Do not include repeating lines , At the same time, sort the default rules ;
UNION Duplicate records will be filtered out after table linking , Therefore, after the table is linked, the generated result set will be sorted , Delete duplicate records and return results .
In practice, most applications will not produce duplicate records , The most common are process tables and history tables UNION
Union All: Combine two result sets , Include repeating lines , No sorting ;
If there are duplicate data in two returned result sets , Then the returned result set will contain duplicate data
example 
The query results of the two tables are as follows 
It's easy to see , Among the test data inserted above , One is repeated
Then we Let's look at the execution first union have a look 
Re execution union all have a look 
边栏推荐
- Microsoft Word tutorial, how to insert a header or footer in word?
- 基于微信电子书阅读小程序毕业设计毕设作品(4)开题报告
- 进程的创建fork()、消亡wait()
- 运算器的基本结构
- mysql的增删改查,mysql常用命令
- exec函数、shell的实现
- Reasonably configure thread pool
- In 2022, 20 cities with the largest number of college students in China
- 今晚7:00 | PhD Debate 自监督学习在推荐系统中的应用
- 2022年最新宁夏建筑安全员模拟题库及答案
猜你喜欢

Demand and business model innovation - demand 2- demand basis

1. Getting to know R

Compilation of programs

硬件测试之—纹波测试为什么不要使用接地夹子

设备管理-借还模块1

Wechat e-book reading applet graduation design works (1) development outline

First build green, then build city

system()

Unsupported class file major version 60

从16页PPT里看懂Jack Dorsey的Web5
随机推荐
Reading small program based on wechat e-book graduation design (4) opening report
94. analyze the content in the web page
Basic structure of arithmetic unit
基于微信电子书阅读小程序毕业设计毕设作品(5)任务书
运算器的基本结构
Are you confused about choosing a low code platform? Follow these three steps
Storage system overview
What is data driven
选电子工程被劝退,真的没前景了?
Microsoft Word tutorial, how to insert a header or footer in word?
基于微信电子书阅读小程序毕业设计毕设作品(4)开题报告
The latest Ningxia construction safety officer simulation question bank and answers in 2022
torch 网络模型转换onnx格式,并可视化
Programming tool download address
Simple understanding of anti shake function
新来的同事问我 where 1=1 是什么意思???
[digital ic/fpga] data accumulation output
基于微信电子书阅读小程序毕业设计毕设作品(1)开发概要
用户权限和组权限
Download and configuration of nuitka packaging tutorial