Home >Database >Mysql Tutorial >What does union mean in mysql?
UNION in MySQL is a union operator used to combine multiple result sets from different tables or queries into a new result set without duplicate rows. The columns in the new result set must have the same Data type and order, but UNION does not support aggregate functions and ORDER BY clauses.
What is UNION in MySQL?
UNION is a union operator in MySQL that is used to combine multiple result sets from different tables or queries into one result set.
How to use UNION?
UNION syntax is as follows:
<code class="sql">SELECT 列名, 列名, ... FROM 表名 UNION SELECT 列名, 列名, ... FROM 表名</code>
Example:
<code class="sql">-- 将表 A 和 B 中的 name 列组合为一个结果集 SELECT name FROM A UNION SELECT name FROM B</code>
Features of UNION:
Limitations of UNION:
The above is the detailed content of What does union mean in mysql?. For more information, please follow other related articles on the PHP Chinese website!