Assignment 2 DBMS
Assignment 2 DBMS
ROLL- 22419MCA013
INSERT ALL
INTO Employee (EmployeeName,Street,City) values ('Anukul','123','Brussels')
INTO Employee (EmployeeName,Street,City) values ('Vikash','567','Varanasi')
INTO Employee (EmployeeName,Street,City) values ('Tiwari','987','Delhi')
INTO Employee (EmployeeName,Street,City) values ('Abhishek','665','Venice')
INTO Employee (EmployeeName,Street,City) values ('Babban','612','Mumbai')
Select * from dual;
insert all
into Works (EmployeeName,CompanyName,Salary) values ('Anukul','First Bank
Corporation',12000)
into Works (EmployeeName,CompanyName,Salary) values ('Tiwari','First Bank
Corporation',16000)
into Works (EmployeeName,CompanyName,Salary) values ('Babban','First Bank
Corporation',8000)
into Works (EmployeeName,CompanyName,Salary) values ('Abhishek','First Bank
Corporation',21000)
into Works (EmployeeName,CompanyName,Salary) values ('Vikash','First Bank
Corporation',4000)
select * from dual;
insert all
into Company (CompanyName,City) values ('First Bank Corporation','Brussels')
into Company (CompanyName,City) values ('Six Bank Corporation','Venice')
into Company (CompanyName,City) values ('Sky Bank Corporation','Mumbai')
into Company (CompanyName,City) values ('Third Bank Corporation','Delhi')
select * from dual;
COMPANYNAME CITY
First Bank Corporation Brussels
Six Bank Corporation Venice
Sky Bank Corporation Mumbai
Third Bank Corporation Delhi
insert all
into Manages (EmployeeName, ManagerName) values ('John Doe', 'Jane Smith')
into Manages (EmployeeName, ManagerName) values ('Bob Johnson', 'Jane Smith')
into Manages (EmployeeName, ManagerName) values ('Mary Brown', 'Bob Johnson')
into Manages (EmployeeName, ManagerName) values ('Ranjit', 'Udit')
select * from dual;
EMPLOYEENAME MANAGERNAME
John Doe Jane Smith
Bob Johnson Jane Smith
Mary Brown Bob Johnson
Ranjit Udit
a. Find the names of all employees who work for First Bank Corporation
b. Find the names and cities of residence of all employees who work for First Bank
Corporation.
c. Find the names, street addresses, and cities of residence of all employees who
work for
First Bank Corporation and earn more than $10,000.
d. Find all employees in the database who live in the same cities as the companies
for
which they work.
e. Find all employees in the database who live in the same cities and on the same
streets
as do their managers.
f. Find all employees in the database who do not work for First Bank Corporation
g. Find all employees in the database who earn more than each employee of Third
Bank
Corporation
h. Find all employees who earn more than the average salary of all employees of
their
company.
k. Find those companies whose employees earn a higher salary, on average, than the
average salary at First Bank Corporation
n. Delete all tuples in the works relation for employees of Six Bank Corporation