Last answered:

18 Mar 2022

Posted on:

10 Mar 2022

1

In the selection from the dept_manager table, why NULL AS emp_no?

In the selection from the dept_manager table, why did we insert a NULL AS emp_no, knowing that this field exists in both tables?

1 answers ( 0 marked as helpful)
Instructor
Posted on:

18 Mar 2022

1

Hi Anas!
Thanks for reaching out.

UNION and UNION ALL could be applied to two tables that have the same structure (i.e. we could have split e.g. the 'departments' table into two, and then use UNION to combine the two parts), so we can create additional columns with NULL values for both tables, so that the "new" tables with the NULL columns would fit and thus can be combined with UNION / UNION ALL.

Hope this helps.
Best,
Tsvetelin

Submit an answer