Union command returns the distinct values after combining the result-sets of the SELECT statements
Suppose you have two tables Table A and Table B as follows:
If you run this above query, you will get the following output
Union All command return all the values (allows duplicate values) after combining the result-set of the SELECT statements.
If you run this query to join tables using UNION ALL, you will get the following output:
Compare both the results set for queries using UNION and UNION ALL operators. You can observe UNION returns only distinct values whereas UNION ALL allows duplicate values also.
You can go through SQL Interview Questions blog by Intellipaat to understand more about Union and Union All operators in SQL.