100% found this document useful (1 vote)
743 views

SQL Module 5 Assignment

The document contains SQL queries that analyze and compare two tables called Employee_details1 and Employee_details2. It arranges the Orders dataset by amount, creates the two tables with sample data, uses set operators like UNION, INTERSECT, and EXCEPT to compare the tables, and selects data from each individual table.

Uploaded by

Isha Karnalkar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
743 views

SQL Module 5 Assignment

The document contains SQL queries that analyze and compare two tables called Employee_details1 and Employee_details2. It arranges the Orders dataset by amount, creates the two tables with sample data, uses set operators like UNION, INTERSECT, and EXCEPT to compare the tables, and selects data from each individual table.

Uploaded by

Isha Karnalkar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

--1.

Arrange the ‘Orders’ dataset in decreasing order of amount

select *
from ord order by amount desc

/*
2.Create a table with name ‘Employee_details1’ and comprising of these columns –
‘Emp_id’, ‘Emp_name’, ‘Emp_salary’.
Create another table with name ‘Employee_details2’, which comprises of same columns as
first table.
*/

create table Employee_details1(Emp_id int primary key,Emp_name varchar


(100),Emp_salary int)

insert into Employee_details1 values(1,'abc',1000);


insert into Employee_details1 values(2,'bbc',2000);
insert into Employee_details1 values(3,'cbc',3000);
insert into Employee_details1 values(4,'dbc',2500);
insert into Employee_details1 values(5,'ebc',1500);

create table Employee_details2(Emp_id int primary key,Emp_name varchar


(100),Emp_salary int)

insert into Employee_details2 values(1,'abc',1000);


insert into Employee_details2 values(2,'bbc',2000);
insert into Employee_details2 values(3,'cbc',3000);
insert into Employee_details2 values(6,'dbc',2500);
insert into Employee_details2 values(7,'ebc',1500);

select * from Employee_details1


select * from Employee_details2

--3.Apply the union operator on these two tables

select * from Employee_details1


union
select * from Employee_details2

--4.Apply the intersect operator on these two tables

select * from Employee_details1


intersect
select * from Employee_details2

--5.Apply the except operator on these two tables

select * from Employee_details1


except
select * from Employee_details2

You might also like