Mock
Mock
a) Find the names, street address, and cities of residence for all employees
who work for 'First Bank Corporation' and earn more than $10,000.
a) select e.employee_name, e.street, e.city FROM
employee e
join
works w on e.employee_name = w.employee_name
where
w.company_name = 'First Bank Corporation'
and w.salary > 10000;
b) Find the names of all employees in the database who live in the same cities as the
companies for which they work
select
e.employee_name from employee e
join
works w on e.employee_name = w.employee_name
join
company c on w.company_name = c.company_name
where
e.city = c.city;
c) Find the names of all employees in the database who live in the same cities and on the same streets as do their managers.
select
e.employee_name from employee e
join
manages m on e.employee_name = m.employee_name
join
employee mgr on m.manager_name = mgr.employee_name
where
e.city = mgr.city and e.street = mgr.street;
4 Create foreign key on
Department Employee
5 Create foreign key on student id in
Library
Student Library:
:
student_id student_name student_branch student_emailid
202 102 7
103 Barkha IT [email protected]
203 103 0
5)