当前位置:网站首页>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详解--在数组和图像中的使用
- 网上开华泰证券的股票账户是否安全呢?
- 5G智慧建筑解决方案2021
- Code de conduite pour la vente de fonds et la gestion de l'information
- QQmlApplicationEngine failed to load component qrc:/main. qml:-1 No such file or directory
- Sm2246en+ SanDisk 15131
- Wechat applet transmits parameters (data-) by clicking events
- Development of wireless U-shaped ultrasonic electric toothbrush
- 基金銷售行為規範及信息管理
- What is SRM system and how to standardize the internal procurement process of the company
猜你喜欢

MaxPool2d详解--在数组和图像中的应用

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
![[NLP] [textcnn] text classification](/img/bb/c8fd9f1ed458a88a17b8d5c70d9ce2.png)
[NLP] [textcnn] text classification

唯一性索引与逻辑删除冲突问题解决思路

Redis' transaction and locking mechanism

女朋友说:你要搞懂了MySQL三大日志,我就让你嘿嘿嘿!

Introduction to digital transformation solutions for enterprises going to sea

206 page Shanghai BIM Technology Application and development report 2021

Kubevela 1.4: make application delivery safer, easier to use, and more transparent

VR panorama adds contrast function to make the display of differentiation effect more intuitive!
随机推荐
MaxPool2d详解--在数组和图像中的应用
How to mention hot fix and cherry pick
How does the VR cloud exhibition hall bring vitality to offline entities? What are the functions?
C# /platform:anycpu32bitpreferred 只能与 /t:exe、/t:winexe 和 /t:appcontainerexe 一起使用
MIT doctoral dissertation optimization theory and machine learning practice
LVM snapshot: preparation of backup based on LVM snapshot
Red Hat将在Project Atomic上运用容器负载服务器
Online customer service system code_ H5 customer service_ Docking with official account_ Support app_ Support for multiple languages
一次革命、两股力量、三大环节:《工业能效提升行动计划》背后的“减碳”路线图
[golang] golang implements the string interception function substr
What does project management really manage?
Reason why wechat payment wxpaypubhelper V3 callback XML is empty
Introduction to machine learning compilation course learning notes lesson 2 tensor program abstraction
Qt笔记(七十四)之QLineEdit指定输入类型
"Paddle + camera" has become a "prefabricated dish" in the AI world, and it is easier to implement industrial AI quality inspection
35 giant technology companies jointly form the meta universe standard Forum Organization
flutter - sort List排序
股票开户要如何办理呢?办理手机开户安全吗
The college entrance examination in 2022 is over. Does anyone really think programmers don't need to study after work?
如何使用 DataAnt 监控 Apache APISIX