Structured Query Language (SQL) – Using the UNION / UNION ALL
In this case, let’s consider the tables such that it will be easier to understand the intricacies of the Union.
Table DEPARTMENT contains the Dept_ID and the Dept_name.
Table EMPLOYEE contains the Emp_ID, emp_name, incentives, deductions and contains the details for the permanent employees.
Table TEMP_EMPLOYEE contains the EMP_ID, emp_name and contains the details for temporary employees. The tables have been segregated to understand the UNION query.