"Union all" means "union all", which refers to the union operation of two result sets, including duplicate rows, without sorting. The UNION operator is used to merge the result sets of two or more SELECT statements; the SELECT statements inside UNION need to have the same number of columns, and the columns need to have similar data types.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
union all operator
Union All refers to two result sets Union operations, including duplicate rows, are not sorted.
The UNION operator is used to combine the result sets of two or more SELECT statements.
Note: The SELECT statements inside UNION must have the same number of columns. Columns must also have similar data types. Also, the order of the columns in each SELECT statement must be the same.
Let’s give an example:
Create database:
Create table:
Insert test data:
Query:
(Recommended tutorial: mysql tutorial)
The above is the detailed content of What does union all mean?. For more information, please follow other related articles on the PHP Chinese website!