当前位置:网站首页>The difference between union and union all in MySQL
The difference between union and union all in MySQL
2022-06-30 23:39:00 【Sun coffee】
One 、 difference 1: Take the intersection of results
1、union: Combine two result sets , Do not include repeating lines , amount to distinct, At the same time, sort the default rules ;
2、union all: Combine two result sets , Include repeating lines , That is, all the results are displayed , Whether it's repetition or not ;
Two 、 difference 2: The operation after getting the result
1、union: Will sort the obtained results
2、union all: No sort operation will be performed on the obtained results
3、 ... and 、 difference 3:
1、union See the results ID=3 There is only one
select * from student2 where id < 4
union
select * from student2 where id > 2 and id < 6
2、union all In the end ID=3 There are two results
select * from student2 where id < 4
union all
select * from student2 where id > 2 and id < 6
Four 、 summary
union all Just merge query results , There's no de duplication or sorting , On the premise of not removing the weight , Use union all It's more efficient than union high
Link to the original text :https://blog.csdn.net/a200822146085/article/details/119545374
边栏推荐
- conv2d详解--在数组和图像中的使用
- Analysis of 8253a register
- flutter - sort List排序
- 高等数学建模
- Shell multitasking to download video at the same time
- MIT doctoral dissertation optimization theory and machine learning practice
- Wordpress blog uses volcano engine veimagex for static resource CDN acceleration (free)
- 35 giant technology companies jointly form the meta universe standard Forum Organization
- How cloud computing can protect online education in the post epidemic Era
- Fund customer service
猜你喜欢

Why should VR panoramic shooting join us? Leverage resources to achieve win-win results

Bridge emqx cloud data to AWS IOT through the public network

Analysis of 8253a register

Fastjson V2 simple user manual

Swift 5.0 - creation and use of swift framework

What is SRM system and how to standardize the internal procurement process of the company

Introduction to digital transformation solutions for enterprises going to sea

1. crawler's beautifulsoup parsing library & online parsing image verification code
![Cesiumjs 2022 ^ source code interpretation [6] - new architecture of modelempirical](/img/ce/519778cd731f814ad111d1e37abd10.png)
Cesiumjs 2022 ^ source code interpretation [6] - new architecture of modelempirical

Achieve secure data sharing among multiple parties and solve the problem of asymmetric information in Inclusive Finance
随机推荐
Zero sample and small sample learning
How do I open a stock account on my mobile phone? In addition, is it safe to open a mobile account?
需求评审,测试人员应该发挥怎样的价值?两分钟让你不再懵逼
股票开户要如何办理呢?办理手机开户安全吗
Fh6908a negative pole turn off synchronous rectification analog low voltage drop diode control IC chip tsot23-6 ultra low power rectifier 1W power consumption < 100ua static replacement mp6908
Cesiumjs 2022 ^ source code interpretation [6] - new architecture of modelempirical
1. crawler's beautifulsoup parsing library & online parsing image verification code
composer
When we look at the industrial Internet, we always look at it from the opposite of the consumer Internet
CentOS 6.3 x64 PHP 5.2.6 扩展安装OpenSSL出错的解决方法
基金管理人公司治理和风险管理
Ms17-010 Eternal Blue vulnerability of MSF
基金销售行为规范及信息管理
Don't worry about whether you can be a coder if you don't learn English well. Learn it first
Never use redis expired monitoring to implement scheduled tasks!
During telecommuting, the project team punched in the wechat group | solicited papers from the community
2022-06-30: what does the following golang code output? A:0; B:2; C: Running error. package main import “fmt“ func main()
Solve arm_ release_ ver of this libmali is ‘g2p0-01eac0‘,rk_ so_ Ver is' 4 ', libgl1 mesa dev will not be installed, and there are unsatisfied dependencies
MaxPool2d详解--在数组和图像中的应用
In depth understanding of jetpack compose kernel: slottable system