What is the difference between UNION and UNIONALL commands in SQL

The UNION command is used to select the related data from two different tables, while using

the UNION command all the selected columns have to to be of the same data type.

Example :

Select EmployeeName from Employees unionSelect EmployeeName from Department

This Query will display only the distinct Employee names in Employees and Department Tables.

The UNION ALL command is similar to UNION command, but it displays all the values in the

both the tables.

Example :

Select EmployeeName from Employees union allSelect EmployeeName from Department

This Query will display all the Employee names in Employees and Department Tables.