You attempt to create a temporary table by using the following statement:
CREATE TEMPORARY TABLE employeesMAIN
SELECT * FROM employees1
UNION ALL
SELECT * FROM employees2;
What is the result?
A.
An error is produced because you cannot create a TEMPORARY TABLE with a UNION.
B.
The employees common to both tables exist in employees MAIN.
C.
A unique list of employees exist in employeesMAIN.
D.
All rows from both tables exist in employeesMAIN.
I think is the D
I probably did this wrong, but I say it cant be A,C since you can use Temp tables with unions. My output gave me non-unique results, also non-common employees existed on the table. So it looks to be D.
create table employ1
(
different int (3),
same int (3)
);
insert into employ1(different,same)
values(10,1),(9,2),(8,3),(7,4);
create table employ2
(
different int (3),
same int (3)
);
insert into employ2(different,same)
values(6,1),(5,2),(4,3),(3,4);
create temporary table q50
select * from employ1
union all
select * from employ2;
select * from q50;
different, same
’10’, ‘1’
‘9’, ‘2’
‘8’, ‘3’
‘7’, ‘4’
‘6’, ‘1’
‘5’, ‘2’
‘4’, ‘3’
‘3’, ‘4’
… also union gets unique while union all get everything/ duplicates, I guess I didn’t need to do all that work up there.
D
D