当前位置:网站首页>Union and union all operators in SQL
Union and union all operators in SQL
2022-07-20 17:12:00 【Secular big tail bear】
SQL UNION The operator
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 .
SQL UNION grammar
SELECT column_name(s) FROM table_name1 UNION SELECT column_name(s) FROM table_name2
SQL UNION ALL grammar
SELECT column_name(s) FROM table_name1 UNION ALL SELECT column_name(s) FROM table_name2
in addition ,UNION The column name in the result set always equals UNION First of all SELECT Column names in statements .
Be careful :
- UNION: Combine two result sets , Do not include repeating lines , At the same time, sort the default rules ;
- UNION All: Combine two result sets , Include repeating lines , No sorting .
Link to the original text :https://www.w3school.com.cn/sql/sql_union.asp
边栏推荐
- Push rejected: Push to origin/master was rejected
- 从APP角度看复杂表格的交互绘制
- 220622_preview,知识点10:DWS层搭建--销售主题宽表--step1--字段抽取
- How does redis analyze slow query operations?
- Prosci human cell line I imprinting human immune research
- 小程序的FLEX的垂直布局弹性压缩
- Distance-Based Background Class Regularization for Open-Set Recognition
- How can redis and MySQL data be consistent?
- Getting to know redis for the first time (I)
- Deep open intent classification with adaptive decision boundary AAAI2021开放集识别论文解读
猜你喜欢
Redis 如何分析慢查询操作?
Leetcode57-插入区间详解
【FreeSwitch开发实践】死锁问题解决Over Session Limit 1000/Locked, Waiting on external entities
Improve the mirror station configuration information - mirror station experience Officer
Conservative Novelty Synthesizing Network forMalware Recognition in an Open-Set Scenario
ID生成器实现方式的优缺点比较以及最优的ID生成器原理剖析
2018的锅让2019来悲
The way of learning C language (I) -- getting to know C language for the first time
IDEA的Import changes 和enable auto-import
Worthington core enzyme -- application field of trypsin
随机推荐
Improve the mirror station configuration information - mirror station experience Officer
ABAP-EXCEL上传下载
Li Hongyi, machine learning 3 Gradient descent
11. 处理机调度的概念、层次
Apifox快速调研
【JDBC】数据库增删改查操作的封装
B. Mark the Dust Sweeper(思维)
SVM的核函数详解
Virtual human live broadcast - how far is the metauniverse from us?
Zero copy is really important!!!
Worthington core enzyme -- application field of trypsin
How does message middleware ensure 100% successful delivery of messages and idempotent design of messages
Deep open intent classification with adaptive decision boundary AAAI2021开放集识别论文解读
Applet learning notes - Cloud Development
Analyze QPS, TPS and other basic concepts from the perspective of multithreading
获取数据库连接的五种方式
Addressing Visual Search in Open and Closed Set Settings
count(1) 比 count(*) 效率高么?
Enhancing The Reliability of Out-of-distribution Image Detection in Neural Networks解读
List集合排序(适用基本类型与对象类型)