Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider this compound query: Swlwct empno, hired from emp unuon all select emp_

ID: 3643717 • Letter: C

Question

Consider this compound query:
Swlwct empno, hired from emp
unuon all
select emp_id, hired, fired from ex_emp;
The columns EMP.EMPNO and EX_EX.EMP.EMP_ID are integer; the columnEMP.HIRED is timestamp; the columns EX_EMP.HIRED and EX_EMP.FIRED are date. Why will the statement fail?

Choose one answer.
A. Because the columns EMPNO and EMP.ID have different names
B. Because the columns EMP.HIRED and EX_EMP.HIRED are different data types.
C. Because there are two columns in the first query and three columns in the second query
D. For all of the reasons above
E. The query will succeed

Explanation / Answer

D. For all of the reasons above union all should have same number of columns with same datatype and names in the both sql statements otherwise the union all wll not work