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

Need help in SQL 1.Create a copy of the emp table as follows: -create table emp2

ID: 3597171 • Letter: N

Question

Need help in SQL

1.Create a copy of the emp table as follows:

-create table emp2 as select * from emp;

-add the following row to the table:

insert into emp2 values(2050, 'CLINTON', 'MANAGER', 7839, (SYSDATE-30), 3000, 0, 40);

-insert another row into the table emp2 using your own last name and whatever data you want.

2.Write a sql statement that gives the row difference between emp and emp2.

3.Write a sql statement that performs a union between emp and emp2. Rerun the sql statement using the union all clause.   Describe the difference between the 2 statements.

4.Write a sql statement that intersects emp and emp2.

emp table has the following columns(EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO)

Explanation / Answer

1.create table emp2
as
(select * from emp)


insert into emp2 values((2050, 'CLINTON', 'MANAGER', 7839, (SYSDATE-30), 3000, 0, 40);

insert into emp2 values((5090,'AISHU','DEVELOPER',2325,(SYDATE-25),5000,0,20);


2.select * from emp2
EXCEPT
select * from emp

3.UNION:-
The union allows us to join multiple tables with distinct operation ny removing duplicates columns.

select * from emp2
UNION
select * from emp

UNION ALL:-
The Union all will join multiple datasets even the tables have duplicates in the records.This wont remove any duplicate records.

select * from emp2
UNION ALL
select * from emp


4.select EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO
from emp,emp2.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote