The more union all is a direct connection, takes all values, records may have duplicate Union is a unique value, record is not duplicated
1. The syntax of UNION is as follows:
[SQL Statement 1]
UNION
[SQL Statement 2]
2. The syntax of UNION all is as follows:
[SQL Statement 1]
UNION All
[SQL Statement 2]
Efficiency:
The Union and UNION ALL keywords combine two result sets into one, but they differ in both usage and efficiency.
1. Processing of duplicate results: Union will filter out duplicate records after the link is made, and union all will not remove duplicate records.
2, the processing of sorting: the Union will be sorted in the order of the fields; UNION all simply merges two results and returns.
In terms of efficiency, union All is much faster than union, so if you can confirm that the combined two result sets do not contain duplicate data and do not require sorting, then use UNION ALL.
In the SQL statement: The difference between the Union and UNION all